note 113890 deleted from function.opendir by cmb
| From: | cmb@php.net | Date: | Tue, 11 Jun 2019 06:37:50 +0000 |
| Subject: | note 113890 deleted from function.opendir by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211217@lists.php.net to get a copy of this message | ||
Note Submitter: no-michael-spam at placecreativecompany dot com
----
You can't rely on is_dir() and a permissions check to know whether opendir() will succeed.
I'm working on a Windows system and accessing files on an OSX share. There are file/folder
names with unsupported characters in them, (such as ">"), so opendir() fails with
"the volume label syntax is incorrect." However, is_dir() will report - correctly - that
it these are valid directories!
Though for what it's worth, Windows can't get in there either. The ">"
character existing in the folder name is a problem for both.
Bottom line: you may need to test the result of opendir() before you go on to process it, even if
you've checked permissions and is_dir() beforehand.