mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 23:49:55 +00:00
Adding fix for Router named arguments where arg value contains the separator key (Ticket #3752)
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6172 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
1d6a63a29a
commit
570e71f62a
2 changed files with 7 additions and 1 deletions
|
@ -1154,7 +1154,7 @@ class Router extends Object {
|
||||||
);
|
);
|
||||||
foreach ($args as $param) {
|
foreach ($args as $param) {
|
||||||
if (strpos($param, $_this->__argSeparator)) {
|
if (strpos($param, $_this->__argSeparator)) {
|
||||||
$param = explode($_this->__argSeparator, $param);
|
$param = explode($_this->__argSeparator, $param, 2);
|
||||||
$named[$param[0]] = $param[1];
|
$named[$param[0]] = $param[1];
|
||||||
} else {
|
} else {
|
||||||
$pass[] = $param;
|
$pass[] = $param;
|
||||||
|
|
|
@ -803,6 +803,12 @@ class RouterTest extends UnitTestCase {
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testNamedArgsUrlParsing() {
|
||||||
|
$result = $this->router->parse('/controller/action/param1:value1:1/param2:value2:3/param:value');
|
||||||
|
$expected = array('pass' => array(), 'named' => array('param1' => 'value1:1', 'param2' => 'value2:3', 'param' => 'value'), 'controller' => 'controller', 'action' => 'action', 'plugin' => null);
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
}
|
||||||
|
|
||||||
function testUrlGenerationWithPrefixes() {
|
function testUrlGenerationWithPrefixes() {
|
||||||
$this->router->reload();
|
$this->router->reload();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue