#42501 [Opn->Fbk]: glob() with GLOB_BRACE using Windows paths
| From: | jani@php.net | Date: | Mon, 03 Sep 2007 11:30:01 +0000 |
| Subject: | #42501 [Opn->Fbk]: glob() with GLOB_BRACE using Windows paths | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-117024@lists.php.net to get a copy of this message | ||
ID: 42501
Updated by: jani@php.net
Reported By: eric at ericmmartin dot com
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: Windows XP
PHP Version: 5.2.4
New Comment:
Try passing GLOB_NOCHECK as flag too, it should return the actual
pattern used then when it doesn't find any files.
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