iliaa Tue Jun 24 09:44:57 2003 EDT
Added files: (Branch: PHP_4_3)
/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
/php-src NEWS
Log:
MFH: 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.38.4.1 php-src/main/fopen_wrappers.h:1.38.4.2
--- php-src/main/fopen_wrappers.h:1.38.4.1 Tue Dec 31 11:25:14 2002
+++ php-src/main/fopen_wrappers.h Tue Jun 24 09:44:56 2003
@@ -15,7 +15,7 @@
| Author: Jim Winstead <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.h,v 1.38.4.1 2002/12/31 16:25:14 sebastian Exp $ */
+/* $Id: fopen_wrappers.h,v 1.38.4.2 2003/06/24 13:44:56 iliaa Exp $ */
#ifndef FOPEN_WRAPPERS_H
#define FOPEN_WRAPPERS_H
@@ -27,6 +27,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.153.2.3 php-src/main/fopen_wrappers.c:1.153.2.4
--- php-src/main/fopen_wrappers.c:1.153.2.3 Sun Feb 23 17:03:54 2003
+++ php-src/main/fopen_wrappers.c Tue Jun 24 09:44:56 2003
@@ -16,7 +16,7 @@
| Jim Winstead <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.c,v 1.153.2.3 2003/02/23 22:03:54 rasmus Exp $ */
+/* $Id: fopen_wrappers.c,v 1.153.2.4 2003/06/24 13:44:56 iliaa Exp $ */
/* {{{ includes
*/
@@ -163,9 +163,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)) {
@@ -191,8 +196,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.112.2.6
php-src/ext/standard/filestat.c:1.112.2.7
--- php-src/ext/standard/filestat.c:1.112.2.6 Tue Apr 22 22:37:29 2003
+++ php-src/ext/standard/filestat.c Tue Jun 24 09:44:57 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filestat.c,v 1.112.2.6 2003/04/23 02:37:29 iliaa Exp $ */
+/* $Id: filestat.c,v 1.112.2.7 2003/06/24 13:44:57 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/NEWS
diff -u php-src/NEWS:1.1247.2.264 php-src/NEWS:1.1247.2.265
--- php-src/NEWS:1.1247.2.264 Mon Jun 23 21:03:07 2003
+++ php-src/NEWS Tue Jun 24 09:44:57 2003
@@ -2,6 +2,8 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
26 Jun 2003, Version 4.3.3RC2
+- Fixed bug #24313 (file_exist() warning on non-existent files
+ when open_basedir is used). (Ilia)
- Fixed bug #24284 (Fixed memory leak inside pg_ping()). (Ilia)
19 Jun 2003, Version 4.3.3RC1
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