Bug #75136 [NEW]: readdir is returning null.

From: Date: Wed, 30 Aug 2017 12:51:13 +0000
Subject: Bug #75136 [NEW]: readdir is returning null.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210878@lists.php.net to get a copy of this message
From: dmitriy dot vinograd at gmail dot com Operating system: Ubuntu 16.04.3 LTS PHP version: 7.0.22 Package: Directory function related Bug Type: Bug Bug description:readdir is returning null. Description: ------------ --- From manual page: http://www.php.net/function.readdir --- readdir(false) is returning a null, despite the fact documentation says it must be a string or false Which may put the example from the documentation in an infinitive loop, and in case if a server is saving warning messages into a log it will fill the server disk that in turn will put the server offline. Test script: --------------- var_dump(readdir(false)); //Will return // Warning: readdir() expects parameter 1 to be resource, boolean given in /..../test.php on line 11 // /..../test.php:11:null while (false !== ($logFile = readdir(false))) { var_dump($logFile); } // Will put your process an infinitive loop -- Edit bug report at https://bugs.php.net/bug.php?id=75136&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75136&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75136&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75136&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75136&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75136&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75136&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75136&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75136&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75136&r=support Expected behavior: https://bugs.php.net/fix.php?id=75136&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75136&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75136&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75136&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75136&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75136&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75136&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75136&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75136&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75136&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75136&r=mysqlcfg

« previous php.bugs (#210878) next »