#39296 [Opn]: is_readable is raising a warning when the file or dir is outside open_basedir

From: Date: Sun, 29 Oct 2006 23:51:07 +0000
Subject: #39296 [Opn]: is_readable is raising a warning when the file or dir is outside open_basedir
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-104148@lists.php.net to get a copy of this message
 ID:               39296
 User updated by:  judas dot iscariote at gmail dot com
 Reported By:      judas dot iscariote at gmail dot com
 Status:           Open
 Bug Type:         Safe Mode/open_basedir
 Operating System: Linux
 PHP Version:      5CVS-2006-10-29 (CVS)
 New Comment:

it is silent in 4_4 , 4.3.9 this annoyance affects the whole stat()
family.

if this is considered a bug in the code here is my fix :

--- ext/standard/filestat.c     2 Jul 2006 13:51:40 -0000      
1.136.2.8.2.3
+++ ext/standard/filestat.c     29 Oct 2006 23:45:54 -0000
@@ -660,7 +660,7 @@
        }

        if ((wrapper = php_stream_locate_url_wrapper(filename, &local,
0 TSRMLS_CC)) == &php_plain_files_wrapper) {
-               if (php_check_open_basedir(local TSRMLS_CC) ||
(PG(safe_mode) && !php_checkuid_ex(filename, NULL,
CHECKUID_ALLOW_FILE_NOT_EXISTS, CHECKUID_NO_ERRORS))) {
+               if (php_check_open_basedir_ex(local, 0 TSRMLS_CC) ||
(PG(safe_mode) && !php_checkuid_ex(filename, NULL,
CHECKUID_ALLOW_FILE_NOT_EXISTS, CHECKUID_NO_ERRORS))) {
                        RETURN_FALSE;
                }
        }

this change was introduced in php 5.1.5 by Ilia.
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c?r1=1.136.2.8&r2=1.136.2.9

it this is considered not to be a bug, please update the documentation
;)


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

[2006-10-29 18:00:29] phpbugs at thequod dot de

Has this changed since 5.1 or 4.x?

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

[2006-10-29 09:52:52] judas dot iscariote at gmail dot com

Description:
------------
is_readable is raising and open_basedir warrning when the file/dir is
not in open_basedir.


this is not expected  or at least is not mentioned in the
documentation.


Reproduce code:
---------------
php  -d display_errors=1 -dopen_basedir=pwd -r
'var_dump(is_readable("/tmp"));'

Expected result:
----------------
a silent 

bool(false)

as stated on the documentation.



Actual result:
--------------
Warning: is_readable(): open_basedir restriction in effect. File(/tmp)
is not within the allowed path(s):
bool(false)




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


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


Thread (4 messages)

« previous php.bugs (#104148) next »