Re: router param mystery
I found the solution. The same bug was reported last year and route.php was fixed. See: https://trac.cakephp.org/ticket/2392 However, the solution is not at all clear from that. Looking at the diff, it seems that the regex should not have braces: 'month' = '(0[1-9]|1[012])', 'day' = '(0[1-9]|[12][0-9]|3[01])' should be: 'month' = '0[1-9]|1[012]', 'day' = '0[1-9]|[12][0-9]|3[01]' The manual should be updated with this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: router param mystery
On Feb 16, 2008 1:21 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Cake 1.2.0.6311-beta The 'day' param in the following route is always passed as the same value as :month, regardless of the :day value in the URL. Router::connect('/events/:year/:month/:day', array('controller' = 'events', 'action' = 'view', 'day' = null), array( 'year' = '[12][0-9]{3}', 'month' = '(0[1-9]|1[012])', 'day' = '(0[1-9]|[12][0-9]|3[01])' ) ); The first line in ViewsController::view() is: debug($this-params); produces: Array ( [pass] = Array ( [0] = 13 [1] = 13 ) [named] = Array ( ) [year] = 2008 [month] = 02 [day] = 02 [plugin] = [controller] = events [action] = view [form] = Array ( ) [url] = Array ( [url] = events/2008/02/13/ ) [bare] = 0 [webservices] = ) If I remove 'day' = null I see this error: The action 2008 is not defined in controller EventsController And I've just noticed that, if I remove the month regex from the route, like so: Router::connect('/events/:year/:month/:day', array('controller' = 'events', 'action' = 'view', 'day' = null), array( 'year' = '[12][0-9]{3}', 'day' = '(0[1-9]|[12][0-9]|3[01])' ) ); then it works: Array ( [pass] = Array ( [0] = 13 ) [named] = Array ( ) [year] = 2008 [month] = 02 [day] = 13 [plugin] = [controller] = events [action] = view [form] = Array ( ) [url] = Array ( [url] = events/2008/02/13 ) [bare] = 0 [webservices] = ) It seems the Route is applying the regex patterns in a really strange way. The month matches against the day pattern and so it is set in params[]. But it seems to me that it shouldn't because there is no named pattern for month. Is this a bug or a feature? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
router param mystery
Cake 1.2.0.6311-beta The 'day' param in the following route is always passed as the same value as :month, regardless of the :day value in the URL. Router::connect('/events/:year/:month/:day', array('controller' = 'events', 'action' = 'view', 'day' = null), array( 'year' = '[12][0-9]{3}', 'month' = '(0[1-9]|1[012])', 'day' = '(0[1-9]|[12][0-9]|3[01])' ) ); The first line in ViewsController::view() is: debug($this-params); produces: Array ( [pass] = Array ( [0] = 13 [1] = 13 ) [named] = Array ( ) [year] = 2008 [month] = 02 [day] = 02 [plugin] = [controller] = events [action] = view [form] = Array ( ) [url] = Array ( [url] = events/2008/02/13/ ) [bare] = 0 [webservices] = ) If I remove 'day' = null I see this error: The action 2008 is not defined in controller EventsController Can anyone spot the problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---