Bug #60180 [Com]: $_SERVER["PHP_SELF"] incorrect
| From: | david dot gero at ec dot gc dot ca | Date: | Mon, 31 Oct 2011 17:40:58 +0000 |
| Subject: | Bug #60180 [Com]: $_SERVER["PHP_SELF"] incorrect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-164731@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60180&edit=1
ID: 60180
Comment by: david dot gero at ec dot gc dot ca
Reported by: david dot gero at ec dot gc dot ca
Summary: $_SERVER["PHP_SELF"] incorrect
Status: Open
Type: Bug
Package: Built-in web server
Operating System: Windows XP with SP3
PHP Version: 5.4SVN-2011-10-31 (snap)
Block user comment: N
Private report: N
New Comment:
Should have said that the snap was tested with the built-in PHP web server, and I was comparing it
against the standard Apache + PHP setup
Previous Comments:
------------------------------------------------------------------------
[2011-10-31 17:25:21] david dot gero at ec dot gc dot ca
Description:
------------
When going to, for example, /admin/phpinfo.php/foo/bar?foo=bar, you should get the following (using
Apache and PHP on Windows XP):
$_SERVER["REQUEST_URI"] == "/admin/phpinfo.php/foo/bar?foo=bar"
$_SERVER["PHP_SELF"] == "/admin/phpinfo.php/foo/bar"
$_SERVER["SCRIPT_NAME"] == "/admin/phpinfo.php"
$_SERVER["PATH_INFO"] == "/foo/bar"
$_SERVER["QUERY_STRING"] == "foo=bar"
In the snap for October 31, 2011, REQUEST_URI, PATH_INFO and QUERY_STRING are correct, but the
following are wrong:
$_SERVER["PHP_SELF"] == "\admin\phpinfo.php" (slashes incorrectly replaced by
backslashes, and PATH_INFO ending has been incorrectly removed)
$_SERVER["SCRIPT_NAME"] == (missing completely)
Test script:
---------------
phpinfo.php file contains:
<?php phpinfo(); ?>
Expected result:
----------------
Going to /admin/phpinfo.php/foo/bar?foo=bar should get:
$_SERVER["REQUEST_URI"] == "/admin/phpinfo.php/foo/bar?foo=bar"
$_SERVER["PHP_SELF"] == "/admin/phpinfo.php/foo/bar"
$_SERVER["SCRIPT_NAME"] == "/admin/phpinfo.php"
$_SERVER["PATH_INFO"] == "/foo/bar"
$_SERVER["QUERY_STRING"] == "foo=bar"
Actual result:
--------------
$_SERVER["REQUEST_URI"] == "/admin/phpinfo.php/foo/bar?foo=bar" (correct)
$_SERVER["PHP_SELF"] == "\admin\phpinfo.php" (incorrect)
$_SERVER["SCRIPT_NAME"] == (not set)
$_SERVER["PATH_INFO"] == "/foo/bar" (correct)
$_SERVER["QUERY_STRING"] == "foo=bar" (correct)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60180&edit=1