#5978: Router::normailze function generates bad url
-------------------------------------------+--------------------------------
Reporter: maksap | Owner: nate
Type: Test Case | Status: reopened
Priority: Medium | Milestone: 1.2.x.x
Component: Routing/Dispatcher | Version: RC3
Severity: Normal | Resolution:
Keywords: url normalize base baseurl | Php_version: n/a
Cake_version: 1.2.0.7692 RC3 |
-------------------------------------------+--------------------------------
Comment (by masom):
this is the test case and it fails...
{{{
<?php
App::import('Core', array('Router', 'Debugger'));
if (!defined('FULL_BASE_URL')) {
define('FULL_BASE_URL', 'http://cakephp.org');
}
class RouterTest extends CakeTestCase {
function setUp() {
Configure::write('Routing.admin', null);
Router::reload();
$this->router =& Router::getInstance();
}
function testUrlPluginNormalization() {
Router::setRequestInfo(array(array(), array('base' =>
'beer','plugin'=>'beers')));
$result = Router::normalize('/beers/add/');
$this->assertEqual($result, '/beers/add/');
Router::reload();
}
}
?>
}}}
I modified my core auth to verify where the /beers/add/ came from and here
what i got:
{{{
var/lib/cakesvn/cake/libs/controller/components/auth.php (line 671)
/beers/add
var/lib/cakesvn/cake/libs/controller/components/auth.php (line 680)
/beers/add
var/lib/cakesvn/cake/libs/controller/components/auth.php (line 681)
/s/add
}}}
the modified auth.php : (Just includes debug info and a die() to stop the
script before redirect)
{{{
Here is the modified CakePHP Auth::redirect() to include debug():
function redirect($url = null) {
if (!is_null($url)) {
$redir = $url;
$this->Session->write('Auth.redirect',
$redir);
} elseif ($this->Session->check('Auth.redirect')) {
$redir =
$this->Session->read('Auth.redirect');
debug($redir);
$this->Session->delete('Auth.redirect');
if (Router::normalize($redir) ==
Router::normalize($thi$
$redir = $this->loginRedirect;
}
} else {
$redir = $this->loginRedirect;
}
debug($redir);
die(debug(Router::normalize($redir)));
return Router::normalize($redir);
}}}
--
Ticket URL: <https://trac.cakephp.org/ticket/5978#comment:6>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---