#43648 [NEW]: Glob definition should read "mixed", not array

From: Date: Fri, 21 Dec 2007 03:20:28 +0000
Subject: #43648 [NEW]: Glob definition should read "mixed", not array
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-362@lists.php.net to get a copy of this message
From: online at metrofindings dot com Operating system: all PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Glob definition should read "mixed", not array Description: ------------ The definition of glob in the PHP documentation reports that glob() returns an array. But the section on return values clearly states that sometimes FALSE is returned. The function definition should report a mixed return value. Also, the return values section says that glob() returns false if the files cannot be read. This is not true. glob() only returns false if the files cannot be read *and* safe_mode is on. http://us2.php.net/glob Reproduce code: --------------- su mkdir foobar; touch foobar/stuff chmod a-rx foobar/stuff chmod a-rx foobar/ exit php -c /etc/php.ini glob.php (with safe_mode off) string(12) "foobar/stuff" array(0) { } php -c /etc/php.ini glob.php (with safe_mode on) string(12) "foobar/stuff" bool(false) Warning: Invalid argument supplied for foreach() in glob.php on line 8 glob.php ============================================ <?php $filesToRemove = glob( dirname(__FILE__).'/foobar/stuff' ); var_dump( dirname(__FILE__).'/foobar/stuff' ); var_dump($filesToRemove); foreach ($filesToRemove as $k => $v) { } ?> Expected result: ---------------- Documentation of return type "mixed". Better note that correctly identifies "safe_mode" as the reason for returning false. -- Edit bug report at http://bugs.php.net/?id=43648&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43648&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43648&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43648&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43648&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43648&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43648&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43648&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43648&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43648&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43648&r=support Expected behavior: http://bugs.php.net/fix.php?id=43648&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43648&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43648&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43648&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43648&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43648&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43648&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43648&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43648&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43648&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43648&r=mysqlcfg

« previous php.doc.bugs (#362) next »