mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
fixed utf-8 pattern in router option
This commit is contained in:
parent
c1551d9828
commit
d5283af818
2 changed files with 25 additions and 1 deletions
|
@ -182,7 +182,7 @@ class CakeRoute {
|
|||
if (!$this->compiled()) {
|
||||
$this->compile();
|
||||
}
|
||||
if (!preg_match($this->_compiledRoute, $url, $route)) {
|
||||
if (!preg_match($this->_compiledRoute, urldecode($url), $route)) {
|
||||
return false;
|
||||
}
|
||||
foreach ($this->defaults as $key => $val) {
|
||||
|
|
|
@ -880,4 +880,28 @@ class CakeRouteTest extends CakeTestCase {
|
|||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* test that utf-8 patterns work for :section
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testUTF8PatternOnSection() {
|
||||
$route = new CakeRoute(
|
||||
'/:section',
|
||||
array('plugin' => 'blogs', 'controller' => 'posts' , 'action' => 'index' ),
|
||||
array(
|
||||
'persist' => array('section'),
|
||||
'section' => 'آموزش|weblog'
|
||||
)
|
||||
);
|
||||
|
||||
$result = $route->parse('/%D8%A2%D9%85%D9%88%D8%B2%D8%B4');
|
||||
$expected = array('section' => 'آموزش', 'plugin' => 'blogs', 'controller' => 'posts', 'action' => 'index', 'pass' => array(), 'named' => array());
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $route->parse('/weblog');
|
||||
$expected = array('section' => 'weblog', 'plugin' => 'blogs', 'controller' => 'posts', 'action' => 'index', 'pass' => array(), 'named' => array());
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue