Bug #74496 [NEW]: php -S fail to handle correctly router and docroot relative path

From: Date: Tue, 25 Apr 2017 10:46:11 +0000
Subject: Bug #74496 [NEW]: php -S fail to handle correctly router and docroot relative path
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208779@lists.php.net to get a copy of this message
From: evaisse at gmail dot com Operating system: Mac OS X 10.12.04 PHP version: 5.6.30 Package: Built-in web server Bug Type: Bug Bug description:php -S fail to handle correctly router and docroot relative path Description: ------------ https://phpbugs-embeddedserver-ttohstztwy.now.sh/_src/?f=Dockerfile If I provide a ./router.php file & a docroot ./public The server works as expected until I receiving a fatal error in a php script (e.g. ./public/kill.php). Then the server is stuck to the following error for all PHP scripts : Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required 'router.php' (include_path='.:') in Unknown on line 0 Note the bug is produced only if the router.php file provide a "return false;" statement on PHP script. If I handle php script via include (e.g. ./router-fix.php), everything works as expected. Test script: --------------- <?php /** * * Run with RELATIVE paths * * $ php -S 127.0.0.1:8089 -t ./public router.php * * then go to /script-that-produce-a-fatal.php * * Next hit on php script will produce strange error. */ $uri = urldecode( parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ); if ($uri !== '/' && file_exists(__DIR__.'/public/'.$uri)) { return false; } else { return readfile(__DIR__ . '/public/index.html'); } Expected result: ---------------- Then the server is stuck to the following error for all PHP scripts : Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required 'router.php' (include_path='.:') in Unknown on line 0 -- Edit bug report at https://bugs.php.net/bug.php?id=74496&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74496&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74496&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74496&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74496&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74496&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74496&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74496&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74496&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74496&r=support Expected behavior: https://bugs.php.net/fix.php?id=74496&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74496&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74496&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74496&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74496&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74496&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74496&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74496&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74496&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74496&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74496&r=mysqlcfg

« previous php.bugs (#208779) next »