php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55726 Changing the working directory makes router script inaccessible
Submitted: 2011-09-19 12:13 UTC Modified: 2011-09-20 07:06 UTC
From: thomas at weinert dot info Assigned: laruence
Status: Closed Package: Built-in web server
PHP Version: 5.4.0beta1 OS: Windows
Private report: No CVE-ID:
 [2011-09-19 12:13 UTC] thomas at weinert dot info
Description:
------------
A router script that calls 'chdir()' to set the working directory for scripts in subdirectories is not found in the next request.

The first request works fine, but the second request outputs an error.

The problem can be avoided using an absolute path for the router script in command line.

Test script:
---------------
<?php

// a subdirectory "admin" is needed 
chdir(__DIR__.'/admin');

echo 'Hallo Welt';

Expected result:
----------------
Hallo Welt

Actual result:
--------------
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required 'chdir-bug.php' (include_path='.;C:\php\pear') in Unknown on line 0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-20 07:04 UTC] laruence@php.net
-Assigned To: +Assigned To: laruence
 [2011-09-20 07:06 UTC] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=317040
Log: Fix Bug #55726 (Changing the working directory makes router script inaccessible)
 [2011-09-20 07:06 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 [2011-09-20 07:06 UTC] laruence@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-04-18 09:48 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=eb233a26f7c9d9eb58dd5c1c0363310982bf0350
Log: Fix Bug #55726 (Changing the working directory makes router script inaccessible)
 [2012-07-24 23:39 UTC] rasmus@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=eb233a26f7c9d9eb58dd5c1c0363310982bf0350
Log: Fix Bug #55726 (Changing the working directory makes router script inaccessible)
 [2013-11-17 09:36 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=eb233a26f7c9d9eb58dd5c1c0363310982bf0350
Log: Fix Bug #55726 (Changing the working directory makes router script inaccessible)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 02:02:10 2014 UTC