Bug #64487 [Opn->Nab]: error move files
| From: | yohgaki@php.net | Date: | Thu, 24 Oct 2013 05:00:43 +0000 |
| Subject: | Bug #64487 [Opn->Nab]: error move files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182422@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64487&edit=1
ID: 64487
Updated by: yohgaki@php.net
Reported by: info at djdb dot be
Summary: error move files
-Status: Open
+Status: Not a bug
Type: Bug
Package: Filesystem function related
Operating System: Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
rename() is not a "mv". You must specify filename, not dir of the destination.
Previous Comments:
------------------------------------------------------------------------
[2013-07-29 21:08:56] mhitza at gmail dot com
Nope.
This issues a warning message when trying to do the move, and doesn't remove the source file
<?php
file_put_contents("text", " ");
rename("text", "/text");
PHP Warning: rename(/text): failed to open stream: Permission denied in /tmp/file.php on line 3
------------------------------------------------------------------------
[2013-03-22 10:25:27] info at djdb dot be
Description:
------------
When you move a file like code
public function Movetobackup($file){
rename($this->HOME.$this->download.$file,
$this->HOME.$this->backup.$file);//TODO BEFORE UPLOAD UNCOMMENT
if($this->debug){print "!!! $file moved!!!";}
//touch($dest, filemtime($src));//reset of the time of a file
}
then wil i lost te file when php has not access to the dest dir.
so i think it is a important issiue
Test script:
---------------
class classe1 {
private $dir = "";
public function Movetobackup($file,$dir){
rename($this->dir.$file, $dir.$file);//TODO BEFORE UPLOAD UNCOMMENT
if($this->debug){print "!!! $file moved!!!";}
//touch($dest, filemtime($src));//reset of the time of a file
}
}
$test = new classe1();
$test->move("myfile.txt","/newdir");
Expected result:
----------------
Actual result:
--------------
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64487&edit=1