Commit 9d5337117da for php.net

commit 9d5337117da719d1fa9e12741d6a9338dc1eb87f
Author: Gina Peter Banyard <girgias@php.net>
Date:   Tue Apr 21 22:34:56 2026 +0100

    ext/phar: reduce scope of variables and clean up CS

diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c
index 297de62231f..129714e2f87 100644
--- a/ext/phar/func_interceptors.c
+++ b/ext/phar/func_interceptors.c
@@ -337,15 +337,12 @@ static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value)
 			wmask=S_IWGRP;
 			xmask=S_IXGRP;
 		} else {
-			int   groups, n, i;
-			gid_t *gids;
-
-			groups = getgroups(0, NULL);
-			if(groups > 0) {
-				gids=(gid_t *)safe_emalloc(groups, sizeof(gid_t), 0);
-				n=getgroups(groups, gids);
-				for(i=0;i<n;++i){
-					if(stat_sb->st_gid==gids[i]) {
+			int groups = getgroups(0, NULL);
+			if (groups > 0) {
+				gid_t *gids = safe_emalloc(groups, sizeof(gid_t), 0);
+				int n = getgroups(groups, gids);
+				for(int i = 0; i < n; ++i){
+					if (stat_sb->st_gid==gids[i]) {
 						rmask=S_IRGRP;
 						wmask=S_IWGRP;
 						xmask=S_IXGRP;
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index 4855517dd62..639ada54e94 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -91,7 +91,7 @@ HashTable cached_alias;
 static void phar_split_cache_list(void) /* {{{ */
 {
 	char *tmp;
-	char *key, *lasts, *end;
+	char *key, *lasts;
 	char ds[2];
 	phar_archive_data *phar;
 	uint32_t i = 0;
@@ -124,7 +124,7 @@ static void phar_split_cache_list(void) /* {{{ */
 			key;
 			key = php_strtok_r(NULL, ds, &lasts)) {
 		size_t len;
-		end = strchr(key, DEFAULT_DIR_SEPARATOR);
+		const char *end = strchr(key, DEFAULT_DIR_SEPARATOR);
 		if (end) {
 			len = end - key;
 		} else {
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 2e309d9a983..54fb674d0e6 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -319,10 +319,9 @@ static void phar_do_403(void) /* {{{ */
 static void phar_do_404(phar_archive_data *phar, char *fname, size_t fname_len, zend_string *f404) /* {{{ */
 {
 	sapi_header_line ctr = {0};
-	phar_entry_info	*info;

 	if (phar && f404 && ZSTR_LEN(f404)) {
-		info = phar_get_entry_info(phar, ZSTR_VAL(f404), ZSTR_LEN(f404), NULL, true);
+		phar_entry_info	*info = phar_get_entry_info(phar, ZSTR_VAL(f404), ZSTR_LEN(f404), NULL, true);

 		if (info) {
 			/* Status doesn't matter, we're exiting anyway. */
@@ -344,7 +343,7 @@ static void phar_do_404(phar_archive_data *phar, char *fname, size_t fname_len,
 /* post-process REQUEST_URI and retrieve the actual request URI.  This is for
    cases like http://localhost/blah.phar/path/to/file.php/extra/stuff
    which calls "blah.phar" file "path/to/file.php" with PATH_INFO "/extra/stuff" */
-static void phar_postprocess_ru_web(char *fname, size_t fname_len, char *entry, size_t *entry_len, char **ru, size_t *ru_len) /* {{{ */
+static void phar_postprocess_ru_web(const char *fname, size_t fname_len, char *entry, size_t *entry_len, char **ru, size_t *ru_len) /* {{{ */
 {
 	char *e = entry + 1, *u1 = NULL, *u = NULL, *saveu = NULL;
 	size_t e_len = *entry_len - 1, u_len = 0;