php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38820 chdir(".") and chdir("..") don't work with Apache 2.0+
Submitted: 2006-09-14 06:40 UTC Modified: 2006-09-27 07:32 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ras at fyn dot dk Assigned:
Status: Closed Package: Directory function related
PHP Version: 5.1.6 OS: Win XP SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ras at fyn dot dk
New email:
PHP Version: OS:

 

 [2006-09-14 06:40 UTC] ras at fyn dot dk
Description:
------------
When using chdir() with relative folders (e.g. "." and ".."), under Apache 2.0 or newer, using either the php5 module or the CGI binary, the function changes the current directory to the Apache application folder, rather than a folder relative to the current folder.

Tested with PHP 5.1.6, and current 5.2.x-dev, under Apache 2.2.3, 2.0.59 and 2.0.55 - all tested with both the php5 module and the CGI binary, all with same result.

Bug appears to be specific to the Windows port of PHP.

Apache 1.3.37 exhibits no similar problems.

I filed this bug with Apache, but Ruediger Pluem at apache.org says that "this is clearly a PHP bug":

http://issues.apache.org/bugzilla/show_bug.cgi?id=40496


Reproduce code:
---------------
// create the "test" folder before running the script!

echo getcwd() . "<br />";
chdir("test");
echo getcwd() . "<br />";
chdir("..");
echo getcwd() . "<br />";
chdir("..");
echo getcwd();


Expected result:
----------------
C:\Web
C:\Web\test
C:\Web
C:\


Actual result:
--------------
C:\Web
C:\Web\test
C:\Programmer\Apache Group
C:\Programmer\Apache Group


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-14 08:50 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-09-14 11:21 UTC] ras at fyn dot dk
Tony, as said - I already tried the current snapshot, downloaded the latest development release yesterday.

Unless it was fixed and updated today, I'm sorry, but I don't have time to uninstall, reinstall and reconfigure Apache and PHP again just now. My current Apache 1.3 installation works just fine for me - I only use the Windows release for testing and development on my workstation...
 [2006-09-25 13:04 UTC] tony2001@php.net
Not reproducible on Linux with Apache2.0.55 worker/prefork.
 [2006-09-26 06:19 UTC] ras at fyn dot dk
No, it does not reproduce on Linux, as said, the bug appears to be specific to the Windows port.
 [2006-09-26 17:30 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-09-27 07:04 UTC] ras at fyn dot dk
Installed under a clean Apache 2.2.3, and it worked!

Thank you for your fast response! :)

Should I change the status of this bug, or will an admin do that?
 [2006-09-27 07:32 UTC] tony2001@php.net
Fixed -> closed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 11:01:31 2024 UTC