-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
$request->getUri(); adds an extra (wrong) slash #8963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's not a bug. |
@fabpot What if you are not using short URLs? |
What do you mean? The shortest resource you can ask for in HTTP is |
If you are using short URLs then there are no files in the URI, only directories, so slashes are ok. But in this case there is no URL rewriting, the URIs are |
I don't understand. Is |
@fabpot yes it's a front controllers, that assumes that index.php is a default if no file specified. What if it was |
The name does not change anything. When you type
You cannot have an empty path. |
If I browse a sf controller directly as |
The above scenario can be avoided by comparing
http://localhost/src/index.php
If a trailing slash is added incorrectly as in /src/index.php/?foo=bar it causes any assets on the page with a relative link, say an image to |
duplicate of #6634 @fabpot for |
@fabpot Thank you for making Symfony such a great framework! I love Symfony and Symfony components and use Symfony a lot for my non-Symfony projects. I guess the original author @cmfcmf was trying to address the same issue as I have run into! I added {
"version": "1.2",
"require": {
"php": ">=5.5.12",
"symfony/yaml": "~3.4",
"symfony/process": "~3.4",
"symfony/http-foundation": "3.3.0",
}
} My project is running on PHP 5.5.12 so I had to use When I use Correct Page URL: That extra slash caused a lot of problems to me. For now I had to remove that slash using the following code. $currentUrl = preg_replace('#\.php/+#i', '.php', $request->getUri(), 1); Obviously I don't like this code :) I guess it's something to deal with |
I downloaded the Symfony Standard Edition 2.3.4 and placed the following code in
app_dev.php
:Then I visited the following url:
http://localhost/RSA-Programm/web/app_dev.php?module=search&type=user&func=form
. The output ishttp://localhost/RSA-Programm/web/app_dev.php/?func=form&module=search&type=user
. Notice the additional slash afterapp_dev.php
.Refs zikula/core#1094. The same problem occurs in Zikula. Routing is not yet enabled so all urls are like the one above (with

index.php
). This causes the url in the profiler to be wrong:The text was updated successfully, but these errors were encountered: