1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Small tyding up of filestat code

This commit is contained in:
Jakub Zelenka
2023-08-28 22:22:54 +01:00
parent 31833e6c4c
commit 4e7ab1478d

View File

@@ -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;