ID: 42501 Updated by: [EMAIL PROTECTED] Reported By: eric at ericmmartin dot com -Status: Open +Status: Assigned Bug Type: Filesystem function related Operating System: Windows XP PHP Version: 5.2.4 Assigned To: pajoye
Previous Comments: ------------------------------------------------------------------------ [2007-10-05 14:45:08] eric at ericmmartin dot com I have confirmed that the nts version works as expected. I still believe that the issue is caused by the colon ':' in the pattern portion of the glob call. For example, the following is still problematic in the non-nts version: <?php $paths = 'c{:/globtest/firstfolder/,:/globtest/secondfolder/}'; $ext = '*.png'; print_r(get_files($paths,$ext)); $paths = 'c:/globtest/'; $ext = '{firstfolder/*.png,secondfolder/*.png}'; print_r(get_files($paths,$ext)); function get_files($paths, $ext) { return glob($paths.$ext,GLOB_BRACE); } ?> Notice, I moved the drive letter out of the pattern, so the pattern does not start with a '{'. It works as expected in the nts version. ------------------------------------------------------------------------ [2007-09-23 09:23:43] tzachi at zend dot com It seems to be a problem with PHP thread-safe. With PHP-NTS that is provided from 5.2.1 and on it seems to work as expected. Apparently the thread-safety version (which is what common in windows) of glob has a problem with pattern that begins with '{'. ------------------------------------------------------------------------ [2007-09-03 14:39:11] eric at ericmmartin dot com >From my previous comment: "I added BLOG_NOCHECK and found"... - I mean GLOB_NOCHECK, of course =) ------------------------------------------------------------------------ [2007-09-03 14:37:32] eric at ericmmartin dot com I added BLOG_NOCHECK and found that I needed to update my first test (it was missing a directory seperator...but even after fixing that, it still fails. Here are the updated tests and results. Reproduce code: --------------- <?php $paths = '{c:/globtest/firstfolder/,c:/globtest/secondfolder/}'; $ext = '*.png'; print_r(get_files($paths,$ext)); $paths = 'c:/globtest/'; $ext = '{firstfolder/*.png,secondfolder/*.png}'; print_r(get_files($paths,$ext)); function get_files($paths, $ext) { return glob($paths.$ext,GLOB_BRACE+GLOB_NOCHECK); } ?> Actual result: -------------- Array ( [0] => c:/globtest/firstfolder/*.png [1] => c:/globtest/secondfolder/*.png ) Array ( [0] => c:/globtest/firstfolder/arrow_down.png [1] => c:/globtest/firstfolder/arrow_off.png [2] => c:/globtest/firstfolder/arrow_up.png [3] => c:/globtest/secondfolder/arrow_down.png [4] => c:/globtest/secondfolder/arrow_off.png [5] => c:/globtest/secondfolder/arrow_up.png ) The pattern looks correct! Even if I use 'arrow_off.png' instead of '*.png' for $ext, glob() fails. It seems like the colon breaks it, for some reason... ------------------------------------------------------------------------ [2007-09-03 11:30:01] [EMAIL PROTECTED] Try passing GLOB_NOCHECK as flag too, it should return the actual pattern used then when it doesn't find any files. ------------------------------------------------------------------------ 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/42501 -- Edit this bug report at http://bugs.php.net/?id=42501&edit=1