From: jeppe at bundsgaard dot net Operating system: FreeBSD 5.2.1-RC PHP version: 4.3.8 PHP Bug Type: Filesystem function related Bug description: When renaming current dir changes to nothing
Description: ------------ When renaming a directory, say ../mydir to ../del/mydir, it seems that php forget the current dir - sets it to nothing. I can resolve the problem by getting the current dir (getcwd) before the rename and setting it after (chdir). It seems that the problem exists when renaming from a dir that is one level smaller than the rename-to dir - so when renaming from ../mydir/subdir to ../del/subdir - everything is ok. I admit: This sounds strange. So it took me some time to locate the problem. And yes: I am sure that ../del exists - this script has been working without problems on a lot of versions of php, a lot of webhotels and a lot of different setups. Reproduce code: --------------- mkdir("../mydir",0777); mkdir("../del",0777); echo "First: ".getcwd(); rename("../mydir","../del/mydir"); echo "<br>And second: ".getcwd(); Expected result: ---------------- First: /usr/home/web/web33953/kursus/admin And second: /usr/home/web/web33953/kursus/admin Actual result: -------------- First: /usr/home/web/web33953/kursus/admin And second: -- Edit bug report at http://bugs.php.net/?id=30089&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30089&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30089&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30089&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30089&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30089&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30089&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30089&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30089&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30089&r=support Expected behavior: http://bugs.php.net/fix.php?id=30089&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30089&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30089&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30089&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30089&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30089&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30089&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30089&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30089&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30089&r=mysqlcfg