mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Fixed small Router bug in previous commit
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6649 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
0c125f362e
commit
f51f051bc2
1 changed files with 2 additions and 1 deletions
|
@ -313,12 +313,13 @@ class Router extends Object {
|
||||||
} elseif ($element == '*') {
|
} elseif ($element == '*') {
|
||||||
$parsed[] = '(?:/(.*))?';
|
$parsed[] = '(?:/(.*))?';
|
||||||
} else if ($namedParam && preg_match_all('/(?!\\\\):([a-z_0-9]+)/i', $element, $matches)) {
|
} else if ($namedParam && preg_match_all('/(?!\\\\):([a-z_0-9]+)/i', $element, $matches)) {
|
||||||
|
$matchCount = count($matches[1]);
|
||||||
foreach ($matches[1] as $i => $name) {
|
foreach ($matches[1] as $i => $name) {
|
||||||
$pos = strpos($element, ':' . $name);
|
$pos = strpos($element, ':' . $name);
|
||||||
$before = substr($element, 0, $pos);
|
$before = substr($element, 0, $pos);
|
||||||
$element = substr($element, $pos+strlen($name)+1);
|
$element = substr($element, $pos+strlen($name)+1);
|
||||||
$after = null;
|
$after = null;
|
||||||
if (next($matches[1]) === false && $element) {
|
if ($i + 1 == $matchCount && $element) {
|
||||||
$after = preg_quote($element);
|
$after = preg_quote($element);
|
||||||
}
|
}
|
||||||
if ($i == 0) {
|
if ($i == 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue