Bug #54570 [Com]: SPLFileObject returns the content of a file after it was deleted

From: Date: Thu, 28 Apr 2011 22:17:51 +0000
Subject: Bug #54570 [Com]: 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-160430@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
 Comment by:         tyra3l at gmail dot com
 Reported by:        bugs dot php at mohiva dot com
 Summary:            SPLFileObject returns the content of a file after it
                     was deleted
 Status:             Open
 Type:               Bug
 Package:            SPL related
 Operating System:   Gentoo Linux
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

http://stackoverflow.com/questions/196897/locking-executing-files-windows-does-
linux-doesnt-why/196908#196908

Tyrael


Previous Comments:
------------------------------------------------------------------------
[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


Thread (4 messages)

« previous php.bugs (#160430) next »