php.net |  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
Votes:34
Avg. Score:4.4 ± 0.8
Reproduced:31 of 33 (93.9%)
Same Version:6 (19.4%)
Same OS:0 (0.0%)
From: galacticvoid+php at gmail dot com Assigned: laruence
Status: Wont fix Package: Built-in web server
PHP Version: 5.4.0 OS: OSX
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

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

Test script:
---------------
<?php
echo $_SERVER['PATH_INFO'];



Request to:
http://locahost:8000/index.php/not.set

Expected result:
----------------
/not.set

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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: 
PATH_INFO.
 [2012-03-07 05:58 UTC] laruence@php.net
Built-in server will consider it as a static file request if there is a dot in the  
SCRIPT_NAME. 

so, it's kind of expect behavior. thanks
 [2012-03-07 05:58 UTC] laruence@php.net
-Status: Open +Status: Wont fix
 [2012-03-07 05:58 UTC] laruence@php.net
-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:
- https://github.com/drush-ops/drush/issues/752
- https://github.com/drush-ops/drush/issues/1641
- https://github.com/drush-ops/drush/pull/1658
 [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
Here

https://github.com/getgrav/grav-plugin-admin/issues/3

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] krakjoe@php.net
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.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Apr 25 14:01:39 2017 UTC