Matt, I've only just started to have a look at this. Having first tried to see if the code worked outside the class I was receiving the same error message but this might be attributable to line 365 including a reference to $srDirectory rather than $rDirectory.
I'll carry on working with it. Regards, Michael Egan -----Original Message----- From: Matt Richards [mailto:[EMAIL PROTECTED] Sent: 17 June 2004 12:51 To: [EMAIL PROTECTED] Subject: [PHP] Very strange bug. Opendir/Readdir[Scanned] 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>} 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The information contained in this email (and in any attachments sent with it) is confidential. It is intended for the addressee only. Access to this email by anyone else is unintended and unauthorized. If you are not the original addressee, 3tc asks you to please maintain confidentiality. If you have received this email in error please notify 3tc immediately by replying to it, then destroy any copies and delete it from your computer system. Any use, dissemination, forwarding, printing or copying of this email by anyone except the addressee in the normal course of his/her business, is strictly prohibited. 3tc owns the copyright in this email and any document created by us and assert the right to be identified as the author of it. Copyright has not been transferred to the addressee. We protect our systems with Sophos Anti-virus - www.sophos.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php