mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing issue where actions starting with a prefix but not followed by an _ would get mangled when going through router::url().
Fixes #1556
This commit is contained in:
parent
139d6b3133
commit
e05c6cd83f
2 changed files with 5 additions and 1 deletions
|
@ -822,7 +822,7 @@ class Router {
|
|||
} elseif (isset($url[$prefix]) && !$url[$prefix]) {
|
||||
unset($url[$prefix]);
|
||||
}
|
||||
if (isset($url[$prefix]) && strpos($url['action'], $prefix) === 0) {
|
||||
if (isset($url[$prefix]) && strpos($url['action'], $prefix . '_') === 0) {
|
||||
$url['action'] = substr($url['action'], strlen($prefix) + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1514,6 +1514,10 @@ class RouterTest extends CakeTestCase {
|
|||
$expected = '/protected/images/edit/1';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = Router::url(array('action' => 'protectededit', 1, 'protected' => true));
|
||||
$expected = '/protected/images/protectededit/1';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = Router::url(array('action' => 'edit', 1, 'protected' => true));
|
||||
$expected = '/protected/images/edit/1';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
|
Loading…
Reference in a new issue