[php-src] master: Collapse if statement in php_stat (#23219)

Kamil Tekiela via GitHub <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Kamil Tekiela (kamil-tekiela)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2026-08-11T18:40:57+01:00

Commit: https://github.com/php/php-src/commit/195b7b556e19a3dda95fbae418bcf34a0e10c3ae
Raw diff: https://github.com/php/php-src/commit/195b7b556e19a3dda95fbae418bcf34a0e10c3ae.diff

Collapse if statement in php_stat (#23219)

Changed paths:
  M  ext/standard/filestat.c


Diff:

diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 96669a809346..13478b6f5c31 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -736,12 +736,12 @@ PHPAPI void php_stat(zend_string *filename, int type, zval *return_value)
 		RETURN_FALSE;
 	}
 	if (IS_ACCESS_CHECK(type)) {
-		if ((wrapper = php_stream_locate_url_wrapper(ZSTR_VAL(filename), &local, 0)) == &php_plain_files_wrapper
-				&& php_check_open_basedir(local)) {
-			RETURN_FALSE;
-		}
-
+		wrapper = php_stream_locate_url_wrapper(ZSTR_VAL(filename), &local, 0);
 		if (wrapper == &php_plain_files_wrapper) {
+			if (php_check_open_basedir(local)) {
+				RETURN_FALSE;
+			}
+
 			char realpath[MAXPATHLEN];
 			const char *file_path_to_check;
 			/* if the wrapper is not found, we need to expand path to match open behavior */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.