|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61286 If the trailing path that follows a script contains a dot PATH_INFO is not set
Submitted: 2012-03-05 13:28 UTC Modified: 2016-03-30 20:22 UTC
Avg. Score:4.1 ± 1.0
Reproduced:79 of 85 (92.9%)
Same Version:18 (22.8%)
Same OS:14 (17.7%)
From: galacticvoid+php at gmail dot com Assigned: laruence (profile)
Status: Wont fix Package: Built-in web server
PHP Version: 5.4.0 OS: OSX
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: galacticvoid+php at gmail dot com
New email:
PHP Version: OS:


 [2012-03-05 13:28 UTC] galacticvoid+php at gmail dot com
If the trailing path that follows a script contains a dot the variable 
$_SERVER['PATH_INFO'] is not set.

Test script:

Request to:

Expected result:

Actual result:
PHP Notice: Undefined index: PATH_INFO ...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-05 16:21 UTC] reeze dot xia at gmail dot com
I can't reproduce it in OSX.  Are you sure you are running 5.4.0 but not previous 
RC versions?
 [2012-03-05 16:52 UTC] galacticvoid+php at gmail dot com
Sorry I was working on this for an hour and I left out the router part.

Using router.php (The only file in __DIR__ is index.php):

   if (file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) {
     return false;
   } else {
     include_once 'index.php';

The results of $_SERVER['PATH_INFO'] when calling http://localhost:8000/notset 
is: /notset.

The results of $_SERVER['PATH_INFO'] when calling http://localhost:8000/not.set 
is: PHP Notice: Undefined index: 
 [2012-03-07 05:58 UTC]
Built-in server will consider it as a static file request if there is a dot in the  

so, it's kind of expect behavior. thanks
 [2012-03-07 05:58 UTC]
-Status: Open +Status: Wont fix
 [2012-03-07 05:58 UTC]
-Assigned To: +Assigned To: laruence
 [2014-10-13 14:14 UTC] tamas at bartatamas dot hu
I've been debugging FuelPHP's router because of this bug. Does it really make sense? Why would a dot mean a static file request? Also, if it does, why was the router fired at all?
I don't really want to run Apache to make my app able to handle requests with a dot in the URI.
 [2015-10-13 11:30 UTC] kenorb at niepodam dot pl
This happens for drush which uses PHP's built-in server.

Related GH issues:
 [2016-01-02 03:05 UTC] dusan dot maliarik at gmail dot com
Dear @laruence, this is non-sense. If you allow it to be routed to the script, but you don't set the PATH_INFO key to what is expected, then that's surely a bug that deserves fixing. If the script returns 404, go ahead, serve the static file.
 [2016-01-02 03:06 UTC] dusan dot maliarik at gmail dot com

apparently there are apps that are forced to include special case for the built-in web server, because it doesn't behave like expected. That kind of counters the goal of it, right?
 [2016-03-30 15:58 UTC] contato at nemostein dot com dot br
This doesn't make any sense... What is the point of letting the router run but not filling the data correctly?!
The router become useless in so many situations because of this.
 [2016-03-30 20:22 UTC]
The internals team have no interest in developing a fully featured, production ready web server.

The CLI web server is only a development server, it does what is necessary for us to run tests, and you can use it for some testing.

Any product that decides to deploy the CLI server as if it were a production ready server is doing so mistakenly.
 [2016-05-25 19:40 UTC] lotyrin at gmail dot com
I don't intend for the PHP internal server to have any additional features, however I do expect its existing features to function regardless of if my routes contain a dot.

I haven't made the mistake of placing the PHP internal server into production use, just perhaps the mistake of placing it into use at all.
 [2017-09-23 21:44 UTC] developer at maurice-meyer dot de
I fully understand the point of the built-in server to be for debugging and testing purposes only and not for production, which makes bugs and issues lower priority than on production systems.

But it leads the purpose of its functionality for testing and debbuing ad absurdum if the behaviour is totally different in the built-in, so I really do not see any reason why this is a wontfix.

@laruence: "Built-in server will consider it as a static file request if there is a dot in the  

Why is that? I guess this could be changed to reflect the functionality it has when its not running as built-in server?
 [2017-12-13 03:57 UTC] lostcodder at gmail dot com
Sometimes i want to download some script and start to debug it fast on PHP built-in server. But if url consists of ".html" postfix it doesnt work. Error 404. Please fix it. Fast deploing of scripts on built-in server is very important part of debugging process!
 [2018-03-12 12:52 UTC] andrzej dot heczko at gmail dot com
I'm using builtin web server for local developing. Its usage is far more easier than managing config files and hostnames for local web server.

Builtin web server should test, if file exists for any url, return it, otherwise pass to the script. Files without extensions are still files.
Now builtin web server behaves strangely.
 [2018-04-11 19:29 UTC] marco dot perrando at gmail dot com
Dear @laruence, you are explaining what the code is doing, and you are correct.

But it seems that users are expecting something different, particularly they want that the the built in server behaves exactly as it is stated on the documentation page.

I have made a PR that should provide this expected behaviour.

Only if a path ends with .php the server responds with a 404 if the corresponding file is not present, otherwise it behaves exactly as for any path which does not correspond to a file: it calls the "index"es setting the PATH_INFO.

I've tried it serving a Drupal 8 local installation and it is working quite fine.

NOTE This is my first contribution to the project, so be patient if something is not as expected.

I invite anyone who need this to try to build from my github repo and give feedback.
 [2023-03-16 21:08 UTC] hermann dot goellner at gmail dot com
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 01 14:01:29 2023 UTC