|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2015-05-13 06:51 UTC] russ at herballure dot com
 Description:
------------
When using glob() on Win 7 64 PHP 5.6.8,
when using GLOB_BRACE with multiple brackets within the braces,
glob() returns an empty array even when files match.
This same function works as expected on PHP 5.3.10 on CentOS 6.7.
Test script:
---------------
$x = glob('D:\\Icons\\*.{[jJ][pP][gG],[gG][iI][fF]}', GLOB_BRACE);
var_dump($x);
/*
The target directory "D:\Icons\" contains these files:
image1.jpg
image2.GIF
image3.bmp
*/
Expected result:
----------------
array(2) {
  [0]=> "D:\Icons\image1.jpg"
  [1]=> "D:\Icons\image2.GIF
}
Actual result:
--------------
array(0) {
}
PatchesPull Requests
Pull requests: 
 HistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
As it is now, all but the last pair of brackets within a braced alternative is simply ignored on Windows. So glob('D:\\Icons\\*.{[jJ][pP][gG],[gG][iI][fF]}', GLOB_BRACE); is actually treated like glob('D:\\Icons\\*.{[gG],[fF]}', GLOB_BRACE);