File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -457,7 +457,7 @@ private function setMask($mask, array $metadata)
457457 }
458458 }
459459
460- if (strpbrk ($ mask , '?<[ ' ) === FALSE ) {
460+ if (strpbrk ($ mask , '?<[] ' ) === FALSE ) {
461461 $ this ->re = '# ' . preg_quote ($ mask , '# ' ) . '/?\z#A ' ;
462462 $ this ->sequence = [$ mask ];
463463 $ this ->metadata = $ metadata ;
@@ -598,7 +598,7 @@ private function setMask($mask, array $metadata)
598598 } while (TRUE );
599599
600600 if ($ brackets ) {
601- throw new Nette \InvalidArgumentException ("Missing closing '] ' in mask ' $ mask'. " );
601+ throw new Nette \InvalidArgumentException ("Missing '[ ' in mask ' $ mask'. " );
602602 }
603603
604604 $ this ->aliases = $ aliases ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Test: Nette\Application\Routers\Route errors.
5+ */
6+
7+ use Nette \Application \Routers \Route ;
8+ use Tester \Assert ;
9+
10+
11+ require __DIR__ . '/../bootstrap.php ' ;
12+
13+
14+ Assert::exception (function () {
15+ $ route = new Route ('[a ' );
16+ }, Nette \InvalidArgumentException::class, "Unexpected '[' in mask '[a'. " );
17+
18+ Assert::exception (function () {
19+ $ route = new Route ('a] ' );
20+ }, Nette \InvalidArgumentException::class, "Missing '[' in mask 'a]'. " );
You can’t perform that action at this time.
0 commit comments