Skip to content

PathInfo not correct if index.php is in the path. #60773

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

Open
sitepark-veltrup opened this issue Jun 12, 2025 · 1 comment
Open

PathInfo not correct if index.php is in the path. #60773

sitepark-veltrup opened this issue Jun 12, 2025 · 1 comment

Comments

@sitepark-veltrup
Copy link

Symfony version(s) affected

7.4

Description

The determination of PathInfo in the \Symfony\Component\HttpFoundation\Request class is not correct if the substring index.php is in the path.
I noticed this because the access control rule no longer works either.

How to reproduce

In my case, SCRIPT_FILENAME, SCRIPT_NAME and PHP_SELF are set as follows.

with index.php

$request = \Symfony\Component\HttpFoundation\Request::create('http://test.com/path/index.php.media/image.jpg');
$request->server->set('SCRIPT_FILENAME', '/var/www/test.com/public/index.php');
$request->server->set('SCRIPT_NAME', '/path/index.php.media/image.jpg');
$request->server->set('PHP_SELF', '/path/index.php.media/image.jpg');
echo $request->getPathInfo();

getPathInfo() returns edia/image.jpg

with index.phx

$request = \Symfony\Component\HttpFoundation\Request::create('http://test.com/path/index.php.media/image.jpg');
$request->server->set('SCRIPT_FILENAME', '/var/www/test.com/public/index.php');
$request->server->set('SCRIPT_NAME', '/path/index.phx.media/image.jpg');
$request->server->set('PHP_SELF', '/path/index.phx.media/image.jpg');
echo $request->getPathInfo();

getPathInfo() returns /path/index.php.media/image.jpg (as expected)

Possible Solution

No response

Additional Context

No response

@jack-worman
Copy link
Contributor

Possibly related: #53746

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants