Edit report at http://bugs.php.net/bug.php?id=52471&edit=1
ID: 52471 User updated by: d dot reade at ReadesGroupServices dot com Reported by: d dot reade at ReadesGroupServices dot com Summary: Folders being treated as files when scandir() is used Status: Bogus Type: Bug Package: Directory function related Operating System: CentOS 5.5 PHP Version: 5.3.3 Block user comment: N New Comment: Sorry I see what you're saying - my bad! :( Previous Comments: ------------------------------------------------------------------------ [2010-07-28 16:17:17] degeb...@php.net You are *never* checking if something is a file. You are only checking if it's a directory. You are making the conclusion that if something is not a directory, then it must be a file. This conclusion is *incorrect*. For instance, there is the possibility that it doesn't even exist, which is the case here. ------------------------------------------------------------------------ [2010-07-28 16:14:22] d dot reade at ReadesGroupServices dot com I don't understand how it's my code? If you run the first example from the CWD, where "folderName" is located along with the test files/folders under "folderName", the results are that the test folders are actually files. The second example should be run from within the "folderName" folder, and this returns the correct results. The code in both examples is the same, the only difference is the folders we're scanning. ------------------------------------------------------------------------ [2010-07-28 16:09:20] degeb...@php.net Yes, I did. The bug is in your code, not in scandir() nor is_dir(). ------------------------------------------------------------------------ [2010-07-28 16:07:23] d dot reade at ReadesGroupServices dot com Did you try the test script? ------------------------------------------------------------------------ [2010-07-28 16:03:09] degeb...@php.net It just returns a string. The output should tell you why it's failing. In Example 1, neither of those exist in the current directory, and things that don't exist are naturally not directories. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52471 -- Edit this bug report at http://bugs.php.net/bug.php?id=52471&edit=1