diff options
Diffstat (limited to 'main/fopen_wrappers.c')
| -rw-r--r-- | main/fopen_wrappers.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 714dc48bff..445e981b8f 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -162,9 +162,14 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path } /* }}} */ +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 @@ PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC) 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; |
