php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60472 PHP_SELF/SCRIPT_NAME wrongly defined in $_SERVER
Submitted: 2011-12-08 16:11 UTC Modified: 2011-12-09 12:59 UTC
From: lolautruche at gmail dot com Assigned:
Status: Not a bug Package: Built-in web server
PHP Version: 5.4.0RC2 OS: Mac OS X 10.7.2 (Lion)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lolautruche at gmail dot com
New email:
PHP Version: OS:

 

 [2011-12-08 16:11 UTC] lolautruche at gmail dot com
Description:
------------
By design, if no PHP script is present in the REQUEST_URI, built-in server 
considers using a directory index (index.php or index.html). However, PHP_SELF 
and SCRIPT_NAME server variables are not correctly filled.

For instance, if I test http://localhost:8000/hello/world, SCRIPT_NAME will be 
"/index.php" and PHP_SELF will be "/index.php/hello/world", while on Apache 
httpd, SCRIPT_NAME and PHP_SELF will be "/hello/world/index.php".

Test script:
---------------
php -S localhost:8000 router.php

router.php script :
<?php
var_dump( $_SERVER );
?>

Expected result:
----------------
Directory index should be AFTER the dir path :
"/hello/world/index.php"

Actual result:
--------------
Directory index is before the dir path :
"/index.php/hello/world"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-09 02:43 UTC] laruence@php.net
is the hello/world is actually a existing folder under you doc root?  I think it's 
no. 

so actullay the built-in server will find the index.php under the doc_root, this 
is a feature(for path_info), not a bug.
 [2011-12-09 02:43 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2011-12-09 10:26 UTC] lolautruche at gmail dot com
Hi

Indeed, it's a virtual folder. I was comparing built-in server behaviour with 
Apache HTTPD's.
So I guess you'd suggest to alter those server variables in the router script ?

Thanks
 [2011-12-09 12:59 UTC] laruence@php.net
-Status: Feedback +Status: Bogus
 [2011-12-09 12:59 UTC] laruence@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

this is not a bug, but a feature. thanks
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC