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:
nate 2007-12-19 01:49:25 +00:00
parent 1d6a63a29a
commit 570e71f62a
2 changed files with 7 additions and 1 deletions

View file

@ -1154,7 +1154,7 @@ class Router extends Object {
);
foreach ($args as $param) {
if (strpos($param, $_this->__argSeparator)) {
$param = explode($_this->__argSeparator, $param);
$param = explode($_this->__argSeparator, $param, 2);
$named[$param[0]] = $param[1];
} else {
$pass[] = $param;

View file

@ -803,6 +803,12 @@ class RouterTest extends UnitTestCase {
$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() {
$this->router->reload();