Bug #75061 [NEW]: Built-in web server does not look up parent dirs for index files
| From: | me at alex dot bio | Date: | Thu, 10 Aug 2017 19:45:21 +0000 |
| Subject: | Bug #75061 [NEW]: Built-in web server does not look up parent dirs for index files | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210589@lists.php.net to get a copy of this message | ||
From: me at alex dot bio
Operating system: Mac OS X 10.12.6
PHP version: 7.1.8
Package: Built-in web server
Bug Type: Bug
Bug description:Built-in web server does not look up parent dirs for index files
Description:
------------
---
From manual page: http://www.php.net/features.commandline.webserver
---
Documentation states that:
`If a URI request does not specify a file, then either index.php or
index.html in the given directory are returned. *****If neither file
exists, the lookup for index.php and index.html will be continued in the
parent directory***** and so on until one is found or the document root
has been reached.`
In reality index files from parent directories are not loaded and 404
Not Found error is returned.
Looks like the bug is here:
https://github.com/php/php-src/blame/master/sapi/cli/php_cli_server.c#L1400
Code returns instead of trying the parent index.[php|html].
Test script:
---------------
Local directory structure:
D www/
F www/index.php
D www/subdir/
Built-in web server is launched like this:
php -S localhost:8888 -t www
Opening http://localhost:8888/dir/ in the browser fails
with 404 error
and the root index.php is not loaded.
Expected result:
----------------
Documentation states that built-in server should open index.[php|html]
in the parent root folder "If a URI request does not specify a file".
The expected result is that the root folder's index.php should be loaded
instead of 404 error.
Actual result:
--------------
opening http://localhost:8888/dir/ fails with 404 error and
the root
index.php is not loaded.
opening http://localhost:8888/dir also fails with 404 error
and the root
index.php is not loaded.
opening http://localhost:8888/notexistingdir
works and correctly loads
www/index.php.
--
Edit bug report at https://bugs.php.net/bug.php?id=75061&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75061&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75061&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75061&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75061&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75061&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75061&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75061&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75061&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75061&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75061&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75061&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75061&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75061&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75061&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75061&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75061&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75061&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75061&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75061&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75061&r=mysqlcfg