#31674 [Opn->Bgs]: glob() returns no results for dirs with brackets in them.
| From: | derick@php.net | Date: | Mon, 24 Jan 2005 07:10:11 +0000 |
| Subject: | #31674 [Opn->Bgs]: glob() returns no results for dirs with brackets in them. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-72727@lists.php.net to get a copy of this message | ||
ID: 31674
Updated by: derick@php.net
Reported By: miika dot ahonen at mbnet dot fi
-Status: Open
+Status: Bogus
Bug Type: *Directory/Filesystem functions
Operating System: Linux
PHP Version: 5.0.3
New Comment:
Brackets make a character class,just as in regular expressions. Escape
them with a \.
Previous Comments:
------------------------------------------------------------------------
[2005-01-24 03:31:07] 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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31674&edit=1