Edit report at https://bugs.php.net/bug.php?id=64487&edit=1
ID: 64487
Comment by: mhitza at gmail dot com
Reported by: info at djdb dot be
Summary: error move files
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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