php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69628 glob() returns empty array on Windows 7, BUT not CentOS 6.7
Submitted: 2015-05-13 06:51 UTC Modified: 2015-05-13 23:16 UTC
From: russ at herballure dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.6.8 OS: Windows 7 SP1 64-bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: russ at herballure dot com
New email:
PHP Version: OS:

 

 [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) {
}

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-05-13 12:29 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2015-05-13 12:29 UTC] cmb@php.net
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);
 [2015-05-13 23:16 UTC] cmb@php.net
-Status: Verified +Status: Analyzed
 [2015-05-13 23:16 UTC] cmb@php.net
See php-src/1278.
 [2015-05-21 06:55 UTC] ab@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e42aae1e9bf5e15d8114c8ae4b5e99cc6e555d9b
Log: fix #69628: complex GLOB_BRACE fails on Windows
 [2015-05-21 06:55 UTC] ab@php.net
-Status: Analyzed +Status: Closed
 [2015-05-21 07:50 UTC] ab@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8c6e8e787023e0a5fb43a9fad98e454a222fb3d5
Log: fix #69628: complex GLOB_BRACE fails on Windows
 [2016-07-20 11:38 UTC] davey@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e42aae1e9bf5e15d8114c8ae4b5e99cc6e555d9b
Log: fix #69628: complex GLOB_BRACE fails on Windows
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 09 14:01:30 2024 UTC