I've got such problem.
i have categories controller with 3 methods, index-do nothing,
show(id=null), copy id to show.ctp, and last:
        function badRequest() {
            $this->cakeError('error404');
        }


in view file index.ctp i have link to show method:
//index.ctp file
echo $html->link("Show", array('controller' => 'categories', 'action'
=> 'show', 'id' => 12, 'bod' => 'zofa'));
------------------------//end of file

i have also coustom routing:
//routers.php file

Router::connectNamed(array('bod' => '.{4}'));

Router::connect('/writings/:id/*', array('controller' => 'categories',
'action' => 'show'),
                array(
                    'pass' => array('id'),
                    'id' => '.{2}'
        ));

Router::connect('/categories',array('controller' => 'categories'));
Router::connect('/categories/*',array('controller' => 'categories',
'action' => 'badRequest'));
.------------------------------------------end router file

And now  in my index.ctp. when i click Show link, the browser redirect
me to page:http://localhost/kejk-1.3.4-0/writings/12/bod:zofa
, and thats ok.
When i change the id to 123 in show.ctp file, this cause routing
create  such link in show link:
http://localhost/kejk-1.3.4-0/categories/show/id:123/bod:zofa

because  the regex 'id'=>'.{2} not match,  and when i click it, FF
redirect me to method badRequest, and i will se error 404, and thats
ok, work fine,

Now change id to 12 again in index.ctp file.
this will create good link to show link, again:http://localhost/
kejk-1.3.4-0/writings/12/bod:zofa
and clicking it redirect  to method show, and now change in browser 12
to 123, and there will be error 404 because regex of routing 'id'=>'.
{2} will not be matched. (sorry of my english)
and thats ok, works fine.


And now when i change bod in index.ctp. to zof, cake create link to
show like:
http://localhost/kejk-1.3.4-0/categories/show/id:12/bod:zof
routing not match to writings because zof not match to regex .{4},
and click on it link will cause redirect to method badRequst, and
error 404 on screen. and thats ok.
but change again bod to zofa, and click in proper link:http://
localhost/kejk-1.3.4-0/writings/12/bod:zofa,
page  writings is opened

And finaly the problem or rather a bug in cakePHP, when I in this good
link: http://localhost/kejk-1.3.4-0/writings/12/bod:zofa
change zofa to zof in browser, not in show.ctp file, routing will not
redirect me to page 404 because the regex
fail:Router::connectNamed(array('bod' => '.{4}')); like this has in id
situation(changed 12 to 123), but just show normal page with named
param bod=>zof

is that shoud be or this is a bug.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"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/cake-php?hl=en

Reply via email to