note 106634 deleted from function.rmdir by danbrown
| From: | danbrown@php.net | Date: | Tue, 29 Nov 2011 15:51:44 +0000 |
| Subject: | note 106634 deleted from function.rmdir by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184795@lists.php.net to get a copy of this message | ||
Note Submitter: stephane
----
Thomas you are right.
Function deleteAll given by O S on 18-Jun-2010 11:30 will fail because readdir is not use correctly.
It should be :
while (false !== ($contents = readdir($directoryHandle))) {
and not :
while ($contents = readdir($directoryHandle)) {
See the readdir "Return value" function.
-- Warning --
This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to
FALSE, such as 0 or "". Please read the section on Booleans for more information. Use the
=== operator for testing the return value of this function.