Bug #54570 [Opn->Bgs]: SPLFileObject returns the content of a file after it was deleted
| From: | bjori@php.net | Date: | Fri, 29 Apr 2011 07:55:23 +0000 |
| Subject: | Bug #54570 [Opn->Bgs]: SPLFileObject returns the content of a file after it was deleted | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160436@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54570&edit=1
ID: 54570
Updated by: bjori@php.net
Reported by: bugs dot php at mohiva dot com
Summary: SPLFileObject returns the content of a file after it
was deleted
-Status: Open
+Status: Bogus
Type: Bug
Package: SPL related
Operating System: Gentoo Linux
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Expected behavior.
Previous Comments:
------------------------------------------------------------------------
[2011-04-29 00:20:33] tyra3l at gmail dot com
shorter url:
http://bit.ly/kdhzpQ
it is normal that you can access a deleted file if you have an open file
descriptor for that file.
and this is exactly what happens here
Tyrael
------------------------------------------------------------------------
[2011-04-29 00:17:49] tyra3l at gmail dot com
http://stackoverflow.com/questions/196897/locking-executing-files-windows-does-
linux-doesnt-why/196908#196908
Tyrael
------------------------------------------------------------------------
[2011-04-19 22:46:01] bugs dot php at mohiva dot com
Description:
------------
With SPLFileObject it is possible to return the content of a file, after
the file was deleted.
Test script:
---------------
file_put_contents('/tmp/file.txt', 'test');
$file = new SplFileObject('/tmp/file.txt');
unlink('/tmp/file.txt');
var_dump(file_exists('/tmp/file.txt'));
while (!$file->eof()) {
echo $file->fgets();
}
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(false)
test
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54570&edit=1