|  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
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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
43 + 34 = ?
Subscribe to this entry?

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


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:

Any suggestions?

Test script:

Expected result:
glob() should return array of files

Actual result:
empty array, no errors


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-29 12:20 UTC]
-Status: Open +Status: Feedback
 [2010-10-29 12:20 UTC]
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:


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]
-Status: Feedback +Status: Open
 [2011-11-16 14:22 UTC]
Please try using this snapshot:
For Windows:

 [2011-11-16 14:22 UTC]
-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-2021 The PHP Group
All rights reserved.
Last updated: Wed Apr 21 23:01:23 2021 UTC