Bug->Doc #70434 [Opn]: cli-server doesn't handle missing directories properly

From: Date: Sat, 05 Sep 2015 17:47:36 +0000
Subject: Bug->Doc #70434 [Opn]: cli-server doesn't handle missing directories properly
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12723@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: Open -Type: Bug +Type: Documentation Problem Package: Built-in web server Operating System: * PHP Version: 5.6.13 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#12723) next »