php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53062 emit error on "readdir" when the directory does no more exists
Submitted: 2010-10-14 06:57 UTC Modified: 2010-11-29 15:32 UTC
From: giorgio dot liscio at email dot it Assigned:
Status: Wont fix Package: *Directory/Filesystem functions
PHP Version: 5.3.3 OS: any?
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: giorgio dot liscio at email dot it
New email:
PHP Version: OS:

 

 [2010-10-14 06:57 UTC] giorgio dot liscio at email dot it
Description:
------------
hi

user 1: opendir("mydir");

at the same time:
user 2: rmdir("mydir");

the dir is removed, but user1 tries to read it:
user 1: readdir(); // no error here

or you can just simply test this:

$handle = opendir('mydir');
rmdir("mydir");
// no error here
// the dir is empty so "echo $file" is not executed, but the dir does not exists, not empty
while (false !== ($file = readdir($handle))) echo $file;



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-29 15:32 UTC] iliaa@php.net
-Status: Open +Status: Wont fix
 [2010-11-29 15:32 UTC] iliaa@php.net
The data handle still exists in memory even those directory was removed. It would 
be too performance inhibitive to check if directory still exists on every call to 
readdir().
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 22:01:23 2019 UTC