Skip to content

Commit

Permalink
Small tyding up of filestat code
Browse files Browse the repository at this point in the history
  • Loading branch information
bukka committed Aug 28, 2023
1 parent 31833e6 commit 4e7ab14
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/standard/filestat.c
Expand Up @@ -721,14 +721,15 @@ PHPAPI void php_stat(zend_string *filename, int type, zval *return_value)
}

if ((wrapper = php_stream_locate_url_wrapper(ZSTR_VAL(filename), &local, 0)) == &php_plain_files_wrapper
&& php_check_open_basedir(local)) {
&& php_check_open_basedir(local)) {
RETURN_FALSE;
}

if (wrapper == &php_plain_files_wrapper) {
char realpath[MAXPATHLEN];
const char *file_path_to_check;
if (strstr(local, "://") == NULL || expand_filepath(local, realpath) == NULL) {
/* if the wrapper is not found, we need to expand path to match open behavior */
if (EXPECTED(strstr(local, "://") == NULL || expand_filepath(local, realpath) == NULL)) {
file_path_to_check = local;
} else {
file_path_to_check = realpath;
Expand Down

0 comments on commit 4e7ab14

Please sign in to comment.