Re: crazy readdir bug
| From: | Peter Clarke | Date: | Fri, 18 Jun 2004 11:59:28 +0000 |
| Subject: | Re: crazy readdir bug | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-188552@lists.php.net to get a copy of this message | ||
Matt Richards wrote:
Imagine the following:
362>class someClass {
363> function someFunction() {
364> if($rDirectory = opendir("/templates")) {
365> while(false != ($strFile = readdir($srDirectory))) {
366> print $strFile."<br />";
367> }
368> }
369> }
370>}
line 364 $rDirectory
line 365 $srDirectory
so $srDirectory does not exist.
-Peter
The class is constructed successfully, the function is called successfuly, the if($rDirectory = opendir("/templates")) statement returns true, and the directory most certainly exists, but as soon as an attempt to read the contents of the directory occurs, the once valid resource ($rDirectory) becomes invalid: Warning: readdir(): 36 is not a valid Directory resource in D:\inetpub\wwwroot\phpSLearningDev\root\components\installer\inc\installer.php on line 365 if the code is removed from both the class and function, it executes fine. I am currently working on a Windows 2003 server (not my choice) and an internal (non network (SMB)) HDD. I can't imagine that simply being inside a class could cause this. Am I missing something!?!?!? I regard myself as a fairly proficient PHP developer, but this one has got a whole dev team stumped. Any thoughts appreciated. Matt Richards matt_DOT_richards_AT_NOSPAM_safetymedia_DOT_co_DOT_uk