Bug #77253 [Fbk->NoF]: PHP_SELF value differs based on path to router script
| From: | php-bugs at lists dot php dot net | Date: | Sun, 29 Aug 2021 04:22:13 +0000 |
| Subject: | Bug #77253 [Fbk->NoF]: PHP_SELF value differs based on path to router script | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236147@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77253&edit=1
ID: 77253
Updated by: php-bugs@lists.php.net
Reported by: andy at aiir dot com
Summary: PHP_SELF value differs based on path to router script
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Built-in web server
Operating System: *nix
PHP Version: 7.2.13
Assigned To: cmb
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2021-08-17 11:59:00] cmb@php.net
I cannot reproduce this with PHP-7.4 on Windows. Is this still an
issue for you with any of the actively supported PHP versions[1]?
[1] <https://www.php.net/supported-versions.php>
------------------------------------------------------------------------
[2018-12-06 16:59:55] andy at aiir dot com
Description:
------------
When running the PHP internal web server, the location of the router script affects the output of
the PHP_SELF value in an unusual way.
If I run PHP from the folder with the script in:
$ php -S 0:8080 index.php
And then call http://localhost:8080/, the value for PHP_SELF
is
/index.php. If I run the script from a parent directory (or any other location that
differs from the script), e.g.:
$ php -S 0:8080 src/index.php
The value for PHP_SELF when request http://localhost:8080/foo/bar will be
/foo/bar.
I'm not certain if this behaviour is intentional or not, but if it is, why is it this way? We
noticed this issue because it breaks a lot of popular routing libraries as they strip the content of
PHP_SELF from the variable they discern the path from, so it fails to route requests correctly.
Test script:
---------------
<?php echo $_SERVER['PHP_SELF'];
Expected result:
----------------
Expect the PHP_SELF value to always provide a path to the script, not change between this and the
web requested path.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77253&edit=1