Edit report at http://bugs.php.net/bug.php?id=48771&edit=1

 ID:                 48771
 Comment by:         tijs_maas at hotmail dot com
 Reported by:        bugs at thundercall dot dk
 Summary:            rename() between drives error: No error
 Status:             Closed
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   win32 only - Windows XP
 PHP Version:        5.3CVS-2009-07-02 (snap)
 Assigned To:        pajoye
 Block user comment: N
 Private report:     N

 New Comment:

I don't know if i am right but i think i also notice this bug. I do not even 
use 

absolute paths.



I could use this function wrong or it is the bug, it sais: No error on line 19



 $pathtothisfolder = explode("/", str_replace(array('//', 

'\\'),'/',dirname(__FILE__)));



    $pathtoUpperParent = "";

    for( $i = 0; $i < count($pathtothisfolder) - 2; $i++ ) {

        $pathtoUpperParent .= $pathtothisfolder[$i]."/";

    }

    $rootname = trim($pathtoUpperParent, versieDirPath());

    

    $parents = count(explode("/", $rootname)) + 2;

    $parentpath = "";

    while ($parents > 0 ) {

        $parentpath .= "../";

        $parents --;

    }

    

    // voer de rename operatie uit

    rename($parentpath.$_GET['versie']."/", $parentpath."sdfsdf/" );



The paths i use are without drives, am I also affected by this bug?


Previous Comments:
------------------------------------------------------------------------
[2010-09-06 13:00:51] ahar...@php.net

Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=303070
Log: Per Pierre's e-mail, add a note that the fix for bug #48771 made 
cross-drive
renames work in Windows.

------------------------------------------------------------------------
[2009-07-06 09:09:33] paj...@php.net

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------
[2009-07-02 09:14:32] paj...@php.net

Verified, missing a flag to allow that.

------------------------------------------------------------------------
[2009-07-02 07:55:34] bugs at thundercall dot dk

$handle = rename($old_file, $new_file);



$old_dir & $new_dir was meant for is_dir() checking before moving files,... but 
as this test didn't needed that, i forgot to remove it from the rename(),.. 
merged it into $old_file & $new_file.

------------------------------------------------------------------------
[2009-07-02 07:51:53] bugs at thundercall dot dk

Description:
------------
When using rename() from one drive to another drive PHP5.3 & Snap 5.3.1 
2009-07-02 fails with error: "No error" and doesn't move the file...

Reproduce code:
---------------
<?php



$old_file = "C:\\Temp\\file.txt";

$new_file = "D:\\Temp\\newfile.txt";



$handle = rename($old_dir.$old_file, $new_dir.$new_file);

if ($handle)

        print "Wuhoo!!";

else

        print "Do'h!";



// $handle = rename($new_dir.$new_file, $old_dir.$old_file); // restore for 
reruns

?>

Expected result:
----------------
Wuhoo!!

Actual result:
--------------
Warning: rename(C:\Temp\file.txt,D:\Temp\newfile.txt) [function.rename]: No 
error in D:\home\main\test\rename\index.php on line 6

Do'h!


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=48771&edit=1

Reply via email to