Bug #74205 [Opn]: PATH_INFO only partial support

From: Date: Thu, 26 Oct 2017 12:43:22 +0000
Subject: Bug #74205 [Opn]: PATH_INFO only partial support
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212328@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74205&edit=1 ID: 74205 Updated by: cmb@php.net Reported by: remi@php.net Summary: PATH_INFO only partial support Status: Open Type: Bug Package: Built-in web server Operating System: irrevelant PHP Version: Next Minor Version Block user comment: N Private report: N New Comment: > It seems to me that this lookup must not occur (respectively, > stop), if the specified (or any intermediate) resource exists. To clarify: on the other hand, the lookup must always happen if the resource does not exist, regardless wether there is a dot or not. Previous Comments: ------------------------------------------------------------------------ [2017-10-26 12:25:21] cmb@php.net > If neither file exists, the lookup for index.php and index.html > will be continued in the parent directory […] It seems to me that this lookup must not occur (respectively, stop), if the specified (or any intermediate) resource exists. Say, there is the following structure: /foo/ /index.php Requesting /foo should respond with 404 (or show the directory listing); requesting /bar should be interpreted as /index.php/bar, i.e. serving /index.php with /bar as PATH_INFO. ------------------------------------------------------------------------ [2017-03-04 17:20:10] remi@php.net Yes, also fix 74061 ------------------------------------------------------------------------ [2017-03-04 17:14:32] requinix@php.net Would the PR also fix bug #74061? ------------------------------------------------------------------------ [2017-03-04 17:12:43] remi@php.net See https://github.com/php/php-src/pull/2403 ------------------------------------------------------------------------ [2017-03-04 17:09:13] remi@php.net Description: ------------ According to documentation http://php.net/manual/en/features.commandline.webserver.php "URI requests are served from the current working directory where PHP was started, unless the -t option is used to specify an explicit document root. 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. If an index.php or index.html is found, it is returned and $_SERVER['PATH_INFO'] is set to the trailing part of the URI. Otherwise a 404 response code is returned." So we can understand this as the apache rewirte equiv to RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] But as soon as the URI contain a dot, this doesn't work. Also see http://discourse.slimframework.com/t/path-issue-404-on-some-routes-using-php-builtin-webserver/1193 Test script: --------------- With a tree containif only a index.php wget -q http://localhost:8888/foo/bar wget -q http://localhost:8888/foo-1.1/bar wget -q http://localhost:8888/foo/bar.png Expected result: ---------------- PHP 7.2.0-dev Development Server started at Sat Mar 4 18:07:49 2017 Listening on http://localhost:8888 Document root is /work/build/phpmaster Press Ctrl-C to quit. [Sat Mar 4 17:56:34 2017] 127.0.0.1:39094 [200]: /foo/bar [Sat Mar 4 17:56:42 2017] 127.0.0.1:39096 [200]: /foo-1.1/bar [Sat Mar 4 17:56:46 2017] 127.0.0.1:39104 [200]: /foo/bar.png Actual result: -------------- PHP 7.2.0-dev Development Server started at Sat Mar 4 18:07:49 2017 Listening on http://localhost:8888 Document root is /work/build/phpmaster Press Ctrl-C to quit. [Sat Mar 4 18:07:53 2017] 127.0.0.1:39402 [200]: /foo/bar [Sat Mar 4 18:07:57 2017] 127.0.0.1:39404 [404]: /foo-1.1/bar - No such file or directory [Sat Mar 4 18:08:01 2017] 127.0.0.1:39412 [404]: /foo/bar.png - No such file or directory ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74205&edit=1

« previous php.bugs (#212328) next »