|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-08-30 12:51 UTC] dmitriy dot vinograd at gmail dot com
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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 01:00:02 2025 UTC |
//What makes you think false is a valid argument for the function? Nothing we even have a check in our code to pretend it, but when you have a lot of processes there is still a chance that it happens in between. Which may occur with our site yesterday, if ($dir = opendir($filePath) && is_numeric($noOfDays) > 0) { while (false !== ($logFile = readdir($dir)))