Bug #53460 [NEW]: glob() returns false for a pattern that matches zero files

From: Date: Fri, 03 Dec 2010 04:57:00 +0000
Subject: Bug #53460 [NEW]: glob() returns false for a pattern that matches zero files
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-156712@lists.php.net to get a copy of this message
From:             
Operating system: Arch Linux
PHP version:      5.3.3
Package:          Filesystem function related
Bug Type:         Bug
Bug description:glob() returns false for a pattern that matches zero files

Description:
------------
On my system the glob() returns false if there are no files matching the
pattern even though the documentation
(http://php.net/manual/en/function.glob.php) states that it should return
an empty array. 

PHP version: 5.3.3

The only things I have changed in php.ini are open_basedir
(/srv/http/:/home/:/usr/share/webapps:/etc/webapps:/tmp/:/usr/share/pear/:/usr/share/symfony)
and enabling of several extensions (mcrypt, mysql, pdo, pdo_sqlite). 

I've seen similar bugs reported and closed a few years ago: #29928

Test script:
---------------
<?php 
    // phpMyAdmin is an empty, existing directory located in Apache root
    $glob = glob('/phpMyAdmin/*');
    echo $glob == false  ? "false\n" : ""; 
    echo is_array($glob) ? "array\n" : ""; 
?>                           

Expected result:
----------------
glob() should return an empty array if no files match the pattern.

Actual result:
--------------
The script prints 'false' when run on my box (both under Apache 2.2.17 and
with php from command line).

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53460&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=53460&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=53460&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=53460&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=53460&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53460&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=53460&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=53460&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=53460&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=53460&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=53460&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=53460&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=53460&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=53460&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=53460&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53460&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53460&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=53460&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=53460&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=53460&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=53460&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=53460&r=mysqlcfg



Thread (9 messages)

« previous php.bugs (#156712) next »