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
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: chealer at gmail dot com
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 07:01:29 2024 UTC