开发者

Symfony: Weird routing issue

开发者 https://www.devze.com 2022-12-25 05:55 出处:网络
I\'ve got following URL in symfony (specifics not important): /frontend_dev.php/something/25/apple ... and a routing rule:

I've got following URL in symfony (specifics not important):

/frontend_dev.php/something/25/apple

... and a routing rule:

/something/:id/:word

The URL works fine when clicked through to on the site, but not when I type in the URL. Instead, symfony says:

Unable to find a matching route to generate url for params "NULL".

The weird thing is that I can navigate to this page and开发者_JS百科 it works, but when hitting Enter in the browser address bar, it no longer finds it.

Any thoughts on what might be the cause of something like this generally?

I should also add that the URL was working fine when typed in the address bar earlier, but doesn't anymore, and I'm not sure what's there that might be interfering with it.

Thanks in advance.

UPDATE:

The exact routing rule:

profile:
  url:    /profile/:id/:un
  param:  {module: profile, action: profile}

UPDATE:

Debug toolbar log (the higlighted part):

Unable to find a matching route to generate url for params "NULL". Toggle debug stack
#4 » in sfException::outputStackTrace() from SF_ROOT_DIR\lib\vendor\symfony\lib\exception\sfException.class.php line 110
#3 » in sfException->printStackTrace() from SF_ROOT_DIR\lib\vendor\symfony\lib\controller\sfFrontWebController.class.php line 52
#2 » in sfFrontWebController->dispatch() from SF_ROOT_DIR\lib\vendor\symfony\lib\util\sfContext.class.php line 170
#1 » in sfContext->dispatch() from SF_ROOT_DIR\web\frontend_dev.php line 13

RESOLVED:

Found it....

I had this in my code on the failing page:

<?php echo link_to(__('Back to previous page').' &#8250;', $sf_request->getReferer()) ?>

The referer fails when typing address into bar.


Unless you're neglecting to mention that you navigate to this page usually from forms and it's the lack of POST data that is upsetting the routing; which I'm thinking this is not- this surely must be an issue with your browser.

Have you tried this in a different browser on your system?

If you're still having issues can you copy in the relevant section of your routing.yml?


I was getting this error message on a live site and found the issue to be a link_to command which was being dynamically populated by a field from the database.

However the field was null, so the link_to received no link info.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号