mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #2799 from sam-at-github/master
Fixed prefixed action prefix reverse routing match. One liner.
This commit is contained in:
commit
6b3a062927
2 changed files with 6 additions and 1 deletions
|
@ -490,7 +490,7 @@ class CakeRoute {
|
||||||
$prefixed = $params['prefix'] . '_';
|
$prefixed = $params['prefix'] . '_';
|
||||||
}
|
}
|
||||||
if (isset($prefixed, $params['action']) && strpos($params['action'], $prefixed) === 0) {
|
if (isset($prefixed, $params['action']) && strpos($params['action'], $prefixed) === 0) {
|
||||||
$params['action'] = substr($params['action'], strlen($prefixed) * -1);
|
$params['action'] = substr($params['action'], strlen($prefixed));
|
||||||
unset($params['prefix']);
|
unset($params['prefix']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,6 +308,11 @@ class CakeRouteTest extends CakeTestCase {
|
||||||
$result = $route->match($url);
|
$result = $route->match($url);
|
||||||
$expected = '/admin/subscriptions/edit_admin_e/1';
|
$expected = '/admin/subscriptions/edit_admin_e/1';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$url = array('controller' => 'subscribe', 'admin' => true, 'action' => 'admin_edit', 1);
|
||||||
|
$result = $route->match($url);
|
||||||
|
$expected = '/admin/subscriptions/edit/1';
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue