php.net |  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
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 !
Your email address:
MUST BE VALID
Solve the problem:
14 + 33 = ?
Subscribe to this entry?

 
 [2011-05-06 08:00 UTC] chealer at gmail dot com
Description:
------------
According to http://php.net/readdir 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"
bool(false)
bool(true)

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

According to the first bullet on http://php.net/manual/en/migration53.incompatible.php this would be an intentional change, so this would be a documentation bug.



Test script:
---------------
var_dump(@readdir(false));

Expected result:
----------------
bool(false)

Actual result:
--------------
NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-06 10:41 UTC] salathe@php.net
-Status: Open +Status: Bogus -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: salathe
 [2011-05-06 10:41 UTC] salathe@php.net
The fact that most functions now return NULL if you feed in bad parameters is 
documented already. See the note on 
http:/www.php.net/manual/en/functions.internal.php
 [2011-05-06 14:08 UTC] salathe@php.net
For anyone trying to click the link in the last comment, it should be

http://www.php.net/manual/en/functions.internal.php
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 30 09:01:25 2020 UTC