Skip to content

Commit 4e7ab14

Browse files
committedAug 28, 2023
Small tyding up of filestat code
1 parent 31833e6 commit 4e7ab14

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎ext/standard/filestat.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -721,14 +721,15 @@ PHPAPI void php_stat(zend_string *filename, int type, zval *return_value)
721721
}
722722

723723
if ((wrapper = php_stream_locate_url_wrapper(ZSTR_VAL(filename), &local, 0)) == &php_plain_files_wrapper
724-
&& php_check_open_basedir(local)) {
724+
&& php_check_open_basedir(local)) {
725725
RETURN_FALSE;
726726
}
727727

728728
if (wrapper == &php_plain_files_wrapper) {
729729
char realpath[MAXPATHLEN];
730730
const char *file_path_to_check;
731-
if (strstr(local, "://") == NULL || expand_filepath(local, realpath) == NULL) {
731+
/* if the wrapper is not found, we need to expand path to match open behavior */
732+
if (EXPECTED(strstr(local, "://") == NULL || expand_filepath(local, realpath) == NULL)) {
732733
file_path_to_check = local;
733734
} else {
734735
file_path_to_check = realpath;

0 commit comments

Comments
 (0)