|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
27 - 1 = ?
Subscribe to this entry?

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

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');
// 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;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-29 15:32 UTC]
-Status: Open +Status: Wont fix
 [2010-11-29 15:32 UTC]
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 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 15:01:28 2024 UTC