#5974: Routing error
---------------------------------------+------------------------------------
    Reporter:  ecamaj                  |          Type:  Bug    
      Status:  new                     |      Priority:  Medium 
   Milestone:  1.2.x.x                 |     Component:  General
     Version:  1.2 Final               |      Severity:  Normal 
    Keywords:  routes, routing, index  |   Php_version:  PHP 5  
Cake_version:                          |  
---------------------------------------+------------------------------------
 1. set route like this:

 {{{
 <?php
 Router::connect('/:category', array('controller' => 'categories', 'action'
 => 'view'), array('category'));
 ?>
 }}}

 2. create some controller/action pair that has action name "index". Let's
 say forum/index.

 3. Create link in some view like this:
 {{{
 <?php
   echo $html->link("test", array('controller'=>'forum,
 'action'=>'index'));
 ?>
 }}}
 or
 {{{
 <?php
   echo $html->link("test", array('controller'=>'forum'));
 ?>
 }}}

 3. Type in a browser address http://[whatever]/forum.
 [[BR]]
 '''It will NOT work -> will be routed to
 http://[whatever]/categories/view.'''
 [[BR]]
 Why is this bug? Two reasons:[[BR]]
 1. in routing, there is no null value set for category parameter:
 {{{
 <?php
 Router::connect('/:category', array('controller' => 'categories', 'action'
 => 'view', 'category'=>null), array('category'));
 ?>
 }}}

 2. in link, there is no category parameter set:
 {{{
 <?php
   echo $html->link("test", array('controller'=>'forum',
 'category'=>$some_value));
 ?>
 }}}

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

Reply via email to