Bug #53190 [Com]: glob() always return empty array

From: Date: Fri, 29 Oct 2010 10:28:13 +0000
Subject: Bug #53190 [Com]: glob() always return empty array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155619@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53190&edit=1

 ID:                 53190
 Comment by:         nsp at h4h dot pl
 Reported by:        nsp at h4h dot pl
 Summary:            glob() always return empty array
 Status:             Feedback
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Linux Debian
 PHP Version:        5.2SVN-2010-10-28 (snap)
 Block user comment: N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2010-10-29 12:20:36] 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-28 11:46:56] 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


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



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


Thread (6 messages)

« previous php.bugs (#155619) next »