php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53190 glob() always return empty array
Submitted: 2010-10-28 11:46 UTC Modified: 2013-02-18 00:34 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: nsp at h4h dot pl Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.2SVN-2010-10-28 (snap) OS: Linux Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nsp at h4h dot pl
New email:
PHP Version: OS:

 

 [2010-10-28 11:46 UTC] nsp at h4h dot pl
Description:
------------
test is simple:

print_r(glob("/var/www/*"));


Always returns empty array.
____________________________

Yes, I know this is strange, yes I have search whole web and no solution yet.

Problem is probably related to OS, because other server (also linux lenny) work OK on the same apache2 and same php5 module.

I have made simple command line test:

sudo -u www-data php5 -c /etc/php5/apache2/php.ini -r 'print_r(glob("/var/www/*"));'


And this is working OK.
My apache2 has no strange modules, this is normal web server.

My system:
php5:  5.2.6.dfsg.1-1+lenny9 
kernel: 2.6.8-2-386
libc6:  2.7-18lenny6 
apache: apache2  2.2.9-10+lenny8 

No special file system security on OS, /var/www is 777, default apache2 security settings.

This problem is VERY rare, but Im not the only one:

same problem here:
http://forums.gentoo.org/viewtopic-t-826894-start-0.html

Any suggestions?
PLEASE HELP!

Test script:
---------------
print_r(glob("/var/www/*"));

Expected result:
----------------
glob() should return array of files

Actual result:
--------------
empty array, no errors

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-29 12:20 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2010-10-29 12:20 UTC] aharvey@php.net
Add error_reporting(-1); ini_set('display_errors', 'on'); to your script before calling glob() and see if any errors are generated.

Also, are you using SELinux by any chance?
 [2010-10-29 12:28 UTC] nsp at h4h dot pl
After adding:
ini_set('display_errors', 'on');

I have no errors, I also try:

error_reporting(E_ALL|E_STRICT);
ini_set('log_errors',1);
assert_options(ASSERT_BAIL,1);

same thing: no errors, empty array

I have try to open this dir and list files by other way, eg. opendir and this way everything is OK and code work as expected.
 [2010-10-29 12:53 UTC] aharvey@php.net
-Status: Feedback +Status: Open
 [2011-11-16 14:22 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2011-11-16 14:22 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC