php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75604 Router script looked up relative to webroot
Submitted: 2017-11-30 17:56 UTC Modified: 2018-01-12 17:21 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: cmb@php.net Assigned: nikic (profile)
Status: Closed Package: Documentation problem
PHP Version: 7.2.0 OS: Windows 10
Private report: No CVE-ID: None
 [2017-11-30 17:56 UTC] cmb@php.net
Description:
------------
Running the built-in webserver with an explicit webroot (-t
option) causes the router script to be looked up relative to the
webroot, but not to the CWD as before.

Apparently, this regression has been introduced when fixing bug
#75287[1].

[1] <http://git.php.net/?p=php-src.git;a=commit;h=816758eda2bcdd69ba505fb6bbb79124a7bf2254>


Test script:
---------------
cd
cat router.php
start php -S localhost:8080 -t www router.php
wget -qO- http://localhost:8080


Expected result:
----------------
c:\php-sdk\phpmaster\vc15\x64

<?php
echo 'hi';

hi


Actual result:
--------------
c:\php-sdk\phpmaster\vc15\x64

<?php
echo 'hi';

<br />
<b>Warning</b>:  Unknown: failed to open stream: No such file or directory in <b>Unknown</b> on line <b>0</b><br />
<br />
<b>Fatal error</b>:  Unknown: Failed opening required 'C:\php-sdk\phpmaster\vc15\x64\www\router.php' (include_path='.;C:\php\pear') in <b>Unknown</b> on line <b>0</b><br />


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-11-30 17:56 UTC] cmb@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: laruence
 [2017-11-30 17:56 UTC] cmb@php.net
Laruence, can you please have a look at this issue?
 [2017-12-02 11:25 UTC] laruence@php.net
I think this is expected, you should use an absoulte path of router , if you don't want  php search it in document_root.
 [2017-12-02 11:44 UTC] cmb@php.net
> I think this is expected, […]

That would be a BC break, though, since formerly the router script
was looked up relative to the CWD where the webserver has been
started.  This would at least have to be documented.
 [2017-12-04 08:23 UTC] laruence@php.net
-Package: Built-in web server +Package: Documentation problem -Assigned To: laruence +Assigned To:
 [2018-01-12 17:21 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2018-01-12 17:21 UTC] nikic@php.net
I have reverted the fix for bug #75287 to restore the old behavior.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 02:03:34 2021 UTC