ID: 28289
User updated by: xuefer at 21cn dot com
-Summary: glob does not support / under windows
Reported By: xuefer at 21cn dot com
Status: Open
Bug Type: Filesystem function related
Operating System: winxp
PHP Version: 4.3.6
New Comment:
it takes me so long time to figure it out: no, don't test it under /
C:\>mkdir tmp
C:\>cd tmp
C:\tmp>mkdir abc
C:\tmp>echo > abc\def
C:\tmp>d:\www\php4\cli\php.exe -r "var_dump(glob('/abc/*'));"
array(1) {
[0]=>
string(8) "/abc/def"
}
C:\tmp>d:\www\php4\cli\php.exe -r "var_dump(glob('/tmp/abc/*'));"
array(0) {
}
Previous Comments:
------------------------------------------------------------------------
[2004-05-06 06:01:45] fvignals at ibsmedia dot com
-- test 1 --
<?php
$path = getcwd();
$driver = $path[0]; // return "c"
print_r( glob( $driver.":\*" ) );
?>
-- test 2 --
<?php print_r( glob( getcwd()."\*" ) ); ?>
-- test 3 --
<?php print_r( glob( "abc/*" ) ); ?>
-- test 4 --
<?php print_r( glob( "/abc/*" ) ); ?>
work under win xp pro and personal, win server 2003
(Note : Apache standalone and IIS services. )
------------------------------------------------------------------------
[2004-05-05 19:40:02] xuefer at 21cn dot com
Description:
------------
path without driver letter(c: d:) failed to work
while other filesystem functions(file_get_contents/fopen) works
under *windows*
Reproduce code:
---------------
<?php
var_dump(glob("/abc/*"));
?>
Expected result:
----------------
array with files in $cur_driver:/abc/ ($cur_driver = driver letter of
getcwd())
Actual result:
--------------
empty array
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28289&edit=1