#48365 [Com]: glob() function returns empty array
| From: | peter dot chen at itg dot com | Date: | Fri, 22 May 2009 21:09:23 +0000 |
| Subject: | #48365 [Com]: glob() function returns empty array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-137659@lists.php.net to get a copy of this message | ||
ID: 48365
Comment by: peter dot chen at itg dot com
Reported By: peter dot chen at itg dot com
Status: Feedback
Bug Type: Apache2 related
Operating System: sparc-sol2.10
PHP Version: 5.2.9
New Comment:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>glob test</title>
</head>
<body>
<?
$path = "/home/apache/htdocs/testkt/";
print("<b>glob:</b><br><br>");
print_r(glob($path . '*.*';));
print("<br><br>***********************<br><br>");
print("<b>scandir:</b><br><br>");
print_r(scandir($path));
?>
</body>
</html>
Previous Comments:
------------------------------------------------------------------------
[2009-05-22 19:43:37] jani@php.net
Please provide proper example script.
------------------------------------------------------------------------
[2009-05-22 19:38:20] peter dot chen at itg dot com
Description:
------------
I am trying to use glob() to display the contents of a directory
I store the path in a variable ($path).
When I give $path as an argument to glob($path), it returns an empty
array.
When I give it to scandir($path), it returns all the files in that
path.
Reproduce code:
---------------
---
From manual page: function.glob
---
Expected result:
----------------
Array ( [0] => . [1] => .. [2] => authtest [3] => globtest.php [4] =>
globtest.php.LCK [5] => globtest2.php [6] => home.php.LCK )
Actual result:
--------------
Array ( )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48365&edit=1