Doc #70434 [Asn->Csd]: cli-server doesn't handle missing directories properly
| From: | cmb@php.net | Date: | Sun, 06 Sep 2015 15:53:27 +0000 |
| Subject: | Doc #70434 [Asn->Csd]: cli-server doesn't handle missing directories properly | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12725@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70434&edit=1
ID: 70434
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: cli-server doesn't handle missing directories
properly
-Status: Assigned
+Status: Closed
Type: Documentation Problem
Package: Built-in web server
Operating System: *
PHP Version: 5.6.13
Assigned To: cmb
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2015-09-06 15:53:03] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=337759
Log: documented lookup of index.(php|html) in parent directories, and respective setting of
PATH_INFO (fixes #70434)
------------------------------------------------------------------------
[2015-09-05 17:47:35] cmb@php.net
Ah, everything get's clearer, if the index.html files are replaced
with index.php files:
<?php echo $_SERVER['PATH_INFO'];
Then the output is:
/baz/
/fool/baz/
That is not really correct, but is obviously rather handy to have
considering that the built-in server doesn't support rewrite
rules. So this is not a bug, but rather a yet undocumented
feature.
------------------------------------------------------------------------
[2015-09-05 17:22:07] cmb@php.net
Related To: Bug #67671
------------------------------------------------------------------------
[2015-09-05 17:18:35] cmb@php.net
Description:
------------
When a directory is requested, the built-in web server looks for
index.(html|php) in this directory; if such a file does not exist,
it responds with 404. Fine.
However, if the directory does not exists, the web server looks
in the parent folder for index.(html|php) and serves that instead.
If index.(html|php) doesn't exist, the lookup continues recursively
until the docroot is reached.
Test script:
---------------
mkdir www
echo www > www/index.html
mkdir www/foo
echo foo > www/foo/index.html
mkdir www/foo/bar
echo bar > www/foo/bar/index.html
php -S localhost:8080
curl http://localhost:8080/foo/baz 2>/dev/null | head
-n 1
curl http://localhost:8080/fool/baz 2>/dev/null |
head -n 1
Expected result:
----------------
<!doctype html><html><head><title>404 Not Found</title><style>
<!doctype html><html><head><title>404 Not Found</title><style>
Actual result:
--------------
foo
www
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70434&edit=1