ID:               47358
 Updated by:       [email protected]
 Reported By:      php at guggemand dot dk
-Status:           Open
+Status:           Bogus
 Bug Type:         Safe Mode/open_basedir
 Operating System: FreeBSD 7.1
 PHP Version:      5.2.9RC1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The function is documented to return FALSE on error. There is no
problem 
here...


Previous Comments:
------------------------------------------------------------------------

[2009-02-11 08:12:10] php at guggemand dot dk

Description:
------------
glob() cant be used directly in foreach when open_basedir is set.

i found #41655 which is about the change causing this, and a few other
closed tickets with "not a bug" as answer.

But that change destroys foreach(glob("nonexistent*") as ... when using
open_basedir, and the following comment in dir.c states that should be
usable.

/* Some glob implementation simply return no data if no matches
   were found, others return the GLOB_NOMATCH error code.
   We don't want to treat GLOB_NOMATCH as an error condition
   so that PHP glob() behaves the same on both types of
   implementations and so that 'foreach (glob() as ...'
   can be used for simple glob() calls without further error
   checking.
*/

As far as i can tell the right thing to do would be to return an empty
array both when using glob("/etc/hosts") and glob("/etc/nonexistent")
when open_basedir is used. Or what am i missing?

Ive been using the following patch, and as far as i can tell its not
possible to check if a file exists when open_basedir is used, and
foreach(glob("nonext*")) works correctly.

http://gugge.dlx.dk/ting/php5-patch-dir.c

Reproduce code:
---------------
set open_basedir /documentroot

open /documentroot/test.php with the following content

<? var_dump(glob("nonexistent*")); ?>


Expected result:
----------------
array(0) {
}


Actual result:
--------------
bool(false) 


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


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

Reply via email to