php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30089 When renaming current dir changes to nothing
Submitted: 2004-09-15 00:25 UTC Modified: 2004-10-10 01:00 UTC
From: jeppe at bundsgaard dot net Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.3.8 OS: FreeBSD 5.2.1-RC
Private report: No CVE-ID: None
 [2004-09-15 00:25 UTC] jeppe at bundsgaard dot net
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: 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-01 21:05 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

I can not reproduce this with latest CVS snapshot using CLI.
Please try with the CLI binary. And if it works, do tell us what webserver you might be using..

 [2004-10-10 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 07:01:27 2024 UTC