php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53601 function rename
Submitted: 2010-12-24 00:32 UTC Modified: 2011-01-03 15:18 UTC
From: tom_84 at hotmail dot it Assigned: iliaa (profile)
Status: Closed Package: Filesystem function related
PHP Version: 5.2.16 OS: debian lenny
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tom_84 at hotmail dot it
New email:
PHP Version: OS:

 

 [2010-12-24 00:32 UTC] tom_84 at hotmail dot it
Description:
------------
---
From manual page: http://www.php.net/function.rename
---
This function should return false on error during file renomination, but in my test script inclusion is executed but renomination it's not executed (no output, expected output:0).

Test script:
---------------
$file = getcwd()."/test.php";
$file2 = $file.".inc";

if (file_exists($file))
{  include $file;
   echo rename($file,$file2);
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-24 05:42 UTC] aharvey@php.net
-Status: Open +Status: Feedback -Package: Unknown/Other Function +Package: Filesystem function related
 [2010-12-24 05:42 UTC] aharvey@php.net
Why are you expecting rename() to fail in this case?

Even if $file was open when rename() was called (and it's not, in this
case), that doesn't prevent a file being renamed on most operating
systems, Linux included.
 [2010-12-24 22:01 UTC] tom_84 at hotmail dot it
-Status: Feedback +Status: Open
 [2010-12-24 22:01 UTC] tom_84 at hotmail dot it
I'm not expecting this strange behavior, in fact I have experienced that in my test case the function rename() it's not executed.
I think that this behavior is php version-related, because on newer php version the job is done exactly as expected.
This is my phpinfo() http://torms.hellospace.net/zzz/php.php
Happy Christmas to all the php developer!
Regards, Tommaso
 [2011-01-03 15:18 UTC] iliaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: iliaa
 [2011-01-03 15:18 UTC] iliaa@php.net
If version 5.2.16 works properly, why the bug? You are reporting an issue on the 
basis of a very old PHP, 5.2.6
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 13:01:33 2025 UTC