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

2011-04-28 Thread tyra3l at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=54570edit=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=54570edit=1


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

2011-04-28 Thread tyra3l at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=54570edit=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:

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


Previous Comments:

[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=54570edit=1