From: ras at fyn dot dk Operating system: Win XP SP2 PHP version: 5.1.6 PHP Bug Type: Directory function related Bug description: chdir(".") and chdir("..") don't work with Apache 2.0+
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 -- Edit bug report at http://bugs.php.net/?id=38820&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38820&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38820&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38820&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38820&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38820&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38820&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38820&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38820&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38820&r=support Expected behavior: http://bugs.php.net/fix.php?id=38820&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38820&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38820&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38820&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38820&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38820&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38820&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38820&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38820&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38820&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38820&r=mysqlcfg