Skip to content

Commit 730bc37

Browse files
committed
Merge pull request KnpLabs#86 from korstiaan/different_type
Allow route parameters don't be of same type
2 parents 884131c + 67199b0 commit 730bc37

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/Knp/Menu/Silex/Voter/RouteVoter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function matchItem(ItemInterface $item)
4141

4242
if (isset($parameters[$route])) {
4343
foreach ($parameters[$route] as $name => $value) {
44-
if ($this->request->attributes->get($name) !== $value) {
44+
if ($this->request->attributes->get($name) != $value) {
4545
return null;
4646
}
4747
}

tests/Knp/Menu/Tests/Silex/Voter/RouteVoterTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ public function provideData()
9292
'foo', array('foo' => array('1' => 'bar')),
9393
true
9494
),
95+
'same single route with same type parameters' => array(
96+
'foo', array('1' => 2),
97+
'foo', array('foo' => array('1' => 2)),
98+
true
99+
),
100+
'same single route with different type parameters' => array(
101+
'foo', array('1' => 2),
102+
'foo', array('foo' => array('1' => '2')),
103+
true
104+
),
105+
95106
);
96107
}
97108
}

0 commit comments

Comments
 (0)