Development

Changeset 6126

You must first sign up to be able to contribute.

Changeset 6126

Show
Ignore:
Timestamp:
11/21/07 10:33:51 (11 months ago)
Author:
noel
Message:

sfRouting : allow numeric parameters (closes #2317)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/routing/sfPatternRouting.class.php

    r5846 r6126  
    423423    } 
    424424 
    425     $params = array_merge($defaults, $params); 
     425    $params = sfToolkit::arrayDeepMerge($defaults, $params); 
    426426 
    427427    $realUrl = preg_replace('/\:([^\/]+)/e', 'urlencode($params["\\1"])', $url); 
  • trunk/test/unit/routing/sfPatternRoutingTest.php

    r5087 r6126  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(65, new lime_output_color()); 
     13$t = new lime_test(67, new lime_output_color()); 
    1414 
    1515class sfPatternRoutingTest extends sfPatternRouting 
     
    160160//$t->is($r->generate('', $params), $url, '->generate() removes the last parameter if the parameter is default value'); 
    161161 
     162// Numerics params 
     163$r->clearRoutes(); 
     164$r->connect('test', '/:module/:action/*', array('module' => 'default', 'action' => 'index')); 
     165$params = array('module' => 'default', 'action' => 'index', 15 => 'foo', 32 => 'bar', 'foo' => 'bar'); 
     166$url = '/default/index/15/foo/32/bar/foo/bar'; 
     167$t->is($r->parse($url), $params, '->parse() routes can have numeric parameters'); 
     168$t->is($r->generate('', $params), $url, '->generate() routes can have numeric parameters'); 
     169 
     170 
    162171$r->clearRoutes(); 
    163172$r->connect('test', '/:module/:action/:test/:id', array('module' => 'default', 'action' => 'index', 'test' => 'foo', 'id' => 'bar'));