From: sysdev at gmx dot net Operating system: Windows Server 2003 PHP version: 5.2.5 PHP Bug Type: Directory function related Bug description: chdir() not working with absolute path / CWD not properly reset
Description: ------------ IIS 6 with PHP 5 SAPI: In some cases, the CWD of a PHP-script run is not properly reset to the script's directory. Its instead the directory of another previously run script. chdir() with an absulote path fails in these cases if the desired path is no child of the script's path itself, while chdir() with a relative path to the same destination succeedes. Reproduce code: --------------- Script located in d:\webshare\web3 echo '<div>CWD is '.getcwd().'</div>'; chdir( 'd:\\webshare\\web3' ); echo '<div>CWD is '.getcwd().'</div>'; chdir( 'd:\\webshare\\web3\\test' ); echo '<div>CWD is '.getcwd().'</div>'; Expected result: ---------------- Script located in d:\webshare\web3 CWD is 'd:\webshare\web3' CWD is 'd:\webshare\web3' CWD is 'd:\webshare\web3\test' Actual result: -------------- Script located in d:\webshare\web3 CWD is 'd:\webshare\another\scripts\path' Warning: chdir() [function.chdir]: No such file or directory (errno 2) in D:\webshare\web3\test.php on line 4 CWD is 'd:\webshare\another\scripts\path' CWD is 'd:\webshare\web3\test' -- or sometimes -- Script located in d:\webshare\web3 CWD is 'd:\webshare\another\scripts\path' Warning: chdir() [function.chdir]: No error (errno 0) in D:\webshare\web3\test.php on line 4 CWD is 'd:\webshare\another\scripts\path' CWD is 'd:\webshare\web3\test' -- Edit bug report at http://bugs.php.net/?id=43977&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43977&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43977&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43977&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43977&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43977&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43977&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43977&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43977&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43977&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43977&r=support Expected behavior: http://bugs.php.net/fix.php?id=43977&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43977&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43977&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43977&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43977&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43977&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43977&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43977&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43977&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43977&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43977&r=mysqlcfg