Open
Description
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