iliaa           Tue Jun 24 09:42:45 2003 EDT

  Added files:                 (Branch: PHP_5)
    /php-src/ext/standard/tests/file    bug24313.phpt 

  Modified files:              
    /php-src/main       fopen_wrappers.h fopen_wrappers.c 
    /php-src/ext/standard       filestat.c 
  Log:
  Fixed bug #24313 (file_exist() warning on non-existent files when 
  open_basedir is used).
  
  
Index: php-src/main/fopen_wrappers.h
diff -u php-src/main/fopen_wrappers.h:1.41 php-src/main/fopen_wrappers.h:1.41.2.1
--- php-src/main/fopen_wrappers.h:1.41  Tue Jun 10 16:03:41 2003
+++ php-src/main/fopen_wrappers.h       Tue Jun 24 09:42:45 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: fopen_wrappers.h,v 1.41 2003/06/10 20:03:41 imajes Exp $ */
+/* $Id: fopen_wrappers.h,v 1.41.2.1 2003/06/24 13:42:45 iliaa Exp $ */
 
 #ifndef FOPEN_WRAPPERS_H
 #define FOPEN_WRAPPERS_H
@@ -28,6 +28,7 @@
 PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC);
 
 PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC);
+PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC);
 PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path 
TSRMLS_DC);
 
 PHPAPI int php_check_safe_mode_include_dir(char *path TSRMLS_DC);
Index: php-src/main/fopen_wrappers.c
diff -u php-src/main/fopen_wrappers.c:1.162 php-src/main/fopen_wrappers.c:1.162.2.1
--- php-src/main/fopen_wrappers.c:1.162 Tue Jun 10 16:03:41 2003
+++ php-src/main/fopen_wrappers.c       Tue Jun 24 09:42:45 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: fopen_wrappers.c,v 1.162 2003/06/10 20:03:41 imajes Exp $ */
+/* $Id: fopen_wrappers.c,v 1.162.2.1 2003/06/24 13:42:45 iliaa Exp $ */
 
 /* {{{ includes
  */
@@ -162,9 +162,14 @@
 }
 /* }}} */
 
+PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC)
+{
+       return php_check_open_basedir_ex(path, 1 TSRMLS_DC);
+}
+
 /* {{{ php_check_open_basedir
  */
-PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC)
+PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC)
 {
        /* Only check when open_basedir is available */
        if (PG(open_basedir) && *PG(open_basedir)) {
@@ -190,8 +195,10 @@
 
                        ptr = end;
                }
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, 
-                       "open_basedir restriction in effect. File(%s) is not within 
the allowed path(s): (%s)", path, PG(open_basedir));
+               if (warn) {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+                               "open_basedir restriction in effect. File(%s) is not 
within the allowed path(s): (%s)", path, PG(open_basedir));
+               }
                efree(pathbuf);
                errno = EPERM; /* we deny permission to open it */
                return -1;
Index: php-src/ext/standard/filestat.c
diff -u php-src/ext/standard/filestat.c:1.122 php-src/ext/standard/filestat.c:1.122.2.1
--- php-src/ext/standard/filestat.c:1.122       Tue Jun 10 16:03:37 2003
+++ php-src/ext/standard/filestat.c     Tue Jun 24 09:42:45 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: filestat.c,v 1.122 2003/06/10 20:03:37 imajes Exp $ */
+/* $Id: filestat.c,v 1.122.2.1 2003/06/24 13:42:45 iliaa Exp $ */
 
 #include "php.h"
 #include "safe_mode.h"
@@ -572,7 +572,7 @@
                RETURN_FALSE;
        }
 
-       if (php_check_open_basedir(filename TSRMLS_CC)) {
+       if (php_check_open_basedir_ex(filename, IS_EXISTS_CHECK(type) ? 0 : 1 
TSRMLS_CC)) {
                RETURN_FALSE;
        }
 

Index: php-src/ext/standard/tests/file/bug24313.phpt
+++ php-src/ext/standard/tests/file/bug24313.phpt



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to