open_basedir is used).
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
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;
}
--- /dev/null
+--TEST--
+Bug #24313: file_exists() warning on non-existant files when is open_basedir enabled
+--INI--
+open_basedir=/tmp
+--FILE--
+<?php
+ var_dump(file_exists("./foobar"));
+?>
+--EXPECT--
+bool(false)
}
/* }}} */
+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)) {
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;
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);