From: eric at ericmmartin dot com
Operating system: Windows XP
PHP version: 5.2.4
PHP Bug Type: Filesystem function related
Bug description: glob() with GLOB_BRACE has different results in Windows
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 bug report at http://bugs.php.net/?id=42501&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42501&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42501&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42501&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42501&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42501&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42501&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42501&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42501&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42501&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42501&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42501&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42501&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42501&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42501&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42501&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42501&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42501&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42501&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42501&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42501&r=mysqlcfg