You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
In situations where there is a file prefix in the REQUEST_URI, UrlMap incorrectly includes it as part of the intended route.
For example, in Symfony during development, you usually visit the app through local.dev/app_dev.php/my/action and Symfony is smart enough to compute the /my/action route automatically, chopping off the app_dev.php.
StackPHP does not chop off this file prefix. It seems to me that this should be the expected behavior.
You can easily reproduce this issue by using two middlewares and UrlMap through a file in the URL.
Make sure that you request this code really through app_dev.php. It doesn't work if app_dev.php is not a real script and the "app_dev.php" is not the basename of the script filename. We can't do anything about this, it's all handled internally by the request object.
I had to use it today and I confirm that the issue exists. In my app, when i access site via app_dev.php,
i had to change server variables in handle to make it work with app_dev.php to:
@CHH Well it will work with the CallableHttpKernel with simple response like you showed, but it will not work with symfony2 app kernel. In my case I have FeatureKernel that extends AppKernel, which have some associated webservices that needs to be mock per feature.
Then im accessing page like app_dev.php/FEATURE-123/ and it boots kernel with needed data.
If i will not change the server variables like I mentioned in sample before, all routings etc will totally mess. Try mapping new AppKernel instead of CallableHttpKernel and You will see errors.
Hope that explanation helps. I didnt found the best way to handle this yet, im currently using modified UrlMap.
@CHH I was using Apache, although I experienced the same problem using the built-in dev server also. I think @defrag is correct - I just tried bootstrapping a Symfony and a Silex kernel and was getting the same behavior. For some reason CallableHttpKernel doesn't exhibit this behavior.
Activity
CHH commentedon Aug 13, 2013
Tested it on the dev server, works for me.
app_dev.php:On the shell:
Request in the browser: http://localhost:4000/app_dev.php/foo and you should get "foo"
Make sure that you request this code really through
app_dev.php. It doesn't work ifapp_dev.phpis not a real script and the "app_dev.php" is not the basename of the script filename. We can't do anything about this, it's all handled internally by the request object.nettles-jarrod commentedon Aug 13, 2013
Your example works correctly, but I invite you to try it with Stack\Builder and a fresh Symfony install.
There's either a problem, or the documentation isn't clear enough on how to handle this.
CHH commentedon Aug 13, 2013
Ok, looking into it.
Am Dienstag, 13. August 2013 schrieb Jarrod Nettles :
Christoph Hochstrasser
http://twitter.com/yuri41 | http://christophh.net | https://github.com/CHH
igorw commentedon Aug 13, 2013
Re-opening, just so this does not get lost.
defrag commentedon Aug 20, 2013
I had to use it today and I confirm that the issue exists. In my app, when i access site via app_dev.php,
i had to change server variables in handle to make it work with app_dev.php to:
cc @Blackshawk
CHH commentedon Aug 20, 2013
@defrag Could you please post the complete file with your code?
CHH commentedon Aug 20, 2013
@Blackshawk:
I've now tried it with Symfony 2.3 Components and Stack Builder and it works without problems on the builtin dev server.
What web server are you using?
Here is my code:
CHH commentedon Aug 20, 2013
@Blackshawk: Will try it with a fresh Symfony install too.
CHH commentedon Aug 20, 2013
@Blackshawk: Tried it with a completely fresh Symfony 2.3 install and it works with
./app/console server:run.I added only this to my
app_dev.php:CHH commentedon Aug 20, 2013
@defrag @Blackshawk Which web server gives you this issues? Apache, NGINX or the builtin dev server?
defrag commentedon Aug 20, 2013
@CHH Well it will work with the CallableHttpKernel with simple response like you showed, but it will not work with symfony2 app kernel. In my case I have FeatureKernel that extends AppKernel, which have some associated webservices that needs to be mock per feature.
Then im accessing page like app_dev.php/FEATURE-123/ and it boots kernel with needed data.
If i will not change the server variables like I mentioned in sample before, all routings etc will totally mess. Try mapping new AppKernel instead of CallableHttpKernel and You will see errors.
Hope that explanation helps. I didnt found the best way to handle this yet, im currently using modified UrlMap.
nettles-jarrod commentedon Aug 20, 2013
@CHH I was using Apache, although I experienced the same problem using the built-in dev server also. I think @defrag is correct - I just tried bootstrapping a Symfony and a Silex kernel and was getting the same behavior. For some reason CallableHttpKernel doesn't exhibit this behavior.
henrikbjorn commentedon Feb 5, 2014
Have the same problem with lighttpd and fpm.