Bug #70434 [NEW]: cli-server doesn't handle missing directories properly
| From: | cmb@php.net | Date: | Sat, 05 Sep 2015 17:18:36 +0000 |
| Subject: | Bug #70434 [NEW]: cli-server doesn't handle missing directories properly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195786@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: 5.6.13
Package: Built-in web server
Bug Type: Bug
Bug description:cli-server doesn't handle missing directories properly
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 bug report at https://bugs.php.net/bug.php?id=70434&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70434&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70434&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70434&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70434&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70434&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70434&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70434&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70434&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70434&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70434&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70434&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70434&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70434&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70434&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70434&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70434&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70434&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70434&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70434&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70434&r=mysqlcfg