#6338: Router::normailze function and App.baseUrl = '/'
---------------------------+------------------------------------------------
    Reporter:  danaki      |          Type:  Bug               
      Status:  new         |      Priority:  Medium            
   Milestone:  1.2.x.x     |     Component:  Routing/Dispatcher
     Version:  1.2 Final   |      Severity:  Normal            
    Keywords:              |   Php_version:  PHP 5             
Cake_version:  1.2.2.8120  |  
---------------------------+------------------------------------------------
 I've got this issue after upgrade to cake_1.2.2.8120, when Auth component
 wouldn't work anymore and sent me to infinite loop after I try to access
 /users/login.[[BR]][[BR]]

 My setup requires custom rewrite rules on my hosting so I have to set
 {{{
 Configure::write('App.baseUrl', '/');
 }}}
 in my core.php to force my urls look nice.[[BR]][[BR]]

 After a little investigation I found that the following code in auth.php
 in startup() function:
 {{{
 print "before $url<br>";
                 $url = Router::normalize($url);
 print "after $url<br>";
 }}}
 gives
 {{{
 before users/login/
 after /userslogin
 }}}
 where 'after' definitely is not correct.[[BR]][[BR]]

 I guess that this preg_replace in Router::normalize() have to match only
 beginning of the url:
 {{{
 if (!empty($paths['base']) && stristr($url, $paths['base'])) {
     $url = preg_replace('/' . preg_quote($paths['base'], '/') . '/', '',
 $url, 1);
 }

 }}}
 My quick fix:
 {{{
     $url = preg_replace('/^' . preg_quote($paths['base'], '/') . '/', '',
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6338>
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
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to