ID:               33047
 Comment by:       ian at res-alian dot com
 Reported By:      wiseman1024 at gmail dot com
 Status:           No Feedback
 Bug Type:         Directory function related
 Operating System: Windows 2000
 PHP Version:      4.3.9
 New Comment:

I get the same problem with glob() using PHP 5.0.2 and 5.1.2 in Windows
2000 (my work computer, NTFS) and in Windows XP (notebook, 5.0.5, NTFS)
but not Linux (server, 5.0.2, ext3). Sorry I can't offer a solution
other than using Linux. I'm not sure if it has to do with the NTFS file
system.

It took me a while to figure out why some folders didn't work, and I
thought it was a permission thing. When I noticed the folder that
worked had no bracket, I tried adding brackets, and that made it not
work. (Also removing the brackets made ones with brackets suddenly
work.) Then I knew what to look for and found this bug entry with
Google.

What's strange is that glob() has no problem returning a list with some
entries containing brackets, but not any entries at all when within a
folder with brackets.

The other strange thing is the opendir() and readdir() work fine in the
same situation under Windows. It's more inconvenient but serves as a
workaround.

--i;


Previous Comments:
------------------------------------------------------------------------

[2005-05-25 01:00:04] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2005-05-17 20:47:36] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip



------------------------------------------------------------------------

[2005-05-17 18:09:30] wiseman1024 at gmail dot com

Description:
------------
glob() won't work (with any pattern and options whatsoever) when one
directory in the current working path has matching brackets [ and ]
with characters between the brackets.

This means glob() will fail if the current working directory is one
of:
C:\php\[hello]
C:\php\[hello]\hello
C:\php\xxx[hello]xxx
C:\php\[hello][

It will work, for example, if the current working directory is one of:
C:\php
C:\php\[hello
C:\php\hello]
C:\php\hello[]

This seems to be a problem when using regular expressions in the
implementation of glob.

Reproduce code:
---------------
/* Returns a list of files and directories, unless inside a directory
with something between brackets*/

print_r(glob('*',FALSE)); 

Expected result:
----------------
Should always return an array with the files (assuming there are files
in the current directory)

Actual result:
--------------
Nothing, because glob() returned false


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33047&edit=1

Reply via email to