|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54673 readdir(false) returns NULL
Submitted: 2011-05-06 08:00 UTC Modified: 2011-05-06 14:08 UTC
From: chealer at gmail dot com Assigned: salathe (profile)
Status: Not a bug Package: Directory function related
PHP Version: 5.3.6 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: chealer at gmail dot com
New email:
PHP Version: OS:


 [2011-05-06 08:00 UTC] chealer at gmail dot com
According to readdir "Returns the filename on success or FALSE on failure." As reported in #52383, since PHP 5.3 readdir may also return NULL on failure.

The regression can be seen here:

# php -r 'var_dump(phpversion(), @readdir(false), @readdir(false)===false);'
string(8) "5.2.11-2"

$ php -r 'var_dump(phpversion(), @readdir(false), @readdir(false)===false);'
string(8) "5.3.6-10"

According to the first bullet on this would be an intentional change, so this would be a documentation bug.

Test script:

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-06 10:41 UTC]
-Status: Open +Status: Bogus -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: salathe
 [2011-05-06 10:41 UTC]
The fact that most functions now return NULL if you feed in bad parameters is 
documented already. See the note on 
 [2011-05-06 14:08 UTC]
For anyone trying to click the link in the last comment, it should be
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jan 26 05:01:24 2021 UTC