ID: 42501
User updated by: eric at ericmmartin dot com
-Summary: glob() with GLOB_BRACE has different results in
Windows
Reported By: eric at ericmmartin dot com
Status: Open
Bug Type: Filesystem function related
Operating System: Windows XP
PHP Version: 5.2.4
New Comment:
Updated title
Previous Comments:
------------------------------------------------------------------------
[2007-08-31 18:05:57] eric at ericmmartin dot com
Description:
------------
glob() with the GLOB_BRACE flag seems to have a bug. I believe that the
colon (:) in a pattern in braces, is causing the problem.
I tried escaping the colon, but that did not seem to work.
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);
}
?>
Expected result:
----------------
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
)
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
)
Actual result:
--------------
Array
(
)
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
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42501&edit=1