| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2005-01-24 03:31 UTC] miika dot ahonen at mbnet dot fi
 Description:
------------
In an attempt to glob() directory with bracket ('[' and/or ']') in its name, I get no results at all.
Reproduce code:
---------------
$dir = "./dir[with]brackets";
if (!is_dir($dir))
   mkdir($dir);
for ($i = 0; $i < 3; $i++)
   file_put_contents($dir."/file.".$i, "foo".$i."\n");
var_dump( glob($dir."/*") );
Expected result:
----------------
Array containing files in the said directory.
Actual result:
--------------
Empty array.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 07:00:01 2025 UTC | 
I don't think that explains why first doing chdir() to such directory and doing just glob("*") fails in similar manner. The chdir() works fine in such cases and with readdir() I can get everything I want from there without any problems.