Commit fdd47f13baf for php.net

commit fdd47f13baf0bfea2652c8a3ddc3e083d83d73f4
Author: Gina Peter Banyard <girgias@php.net>
Date:   Tue Sep 1 20:06:19 2026 +0100

    pcre: refactor preg_get_backref()

diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index fd5d407b154..088db5d7bef 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1514,17 +1514,17 @@ PHP_FUNCTION(preg_match_all)
 }
 /* }}} */

-/* {{{ preg_get_backref */
-static int preg_get_backref(char **str, int *backref)
+static bool preg_get_backref(char **str, int *backref)
 {
-	char in_brace = 0;
+	bool in_brace = false;
 	char *walk = *str;

-	if (walk[1] == 0)
-		return 0;
+	if (walk[1] == 0) {
+		return false;
+	}

 	if (*walk == '$' && walk[1] == '{') {
-		in_brace = 1;
+		in_brace = true;
 		walk++;
 	}
 	walk++;
@@ -1532,8 +1532,9 @@ static int preg_get_backref(char **str, int *backref)
 	if (*walk >= '0' && *walk <= '9') {
 		*backref = *walk - '0';
 		walk++;
-	} else
-		return 0;
+	} else {
+		return false;
+	}

 	if (*walk && *walk >= '0' && *walk <= '9') {
 		*backref = *backref * 10 + *walk - '0';
@@ -1541,16 +1542,15 @@ static int preg_get_backref(char **str, int *backref)
 	}

 	if (in_brace) {
-		if (*walk != '}')
-			return 0;
-		else
-			walk++;
+		if (*walk != '}') {
+			return false;
+		}
+		walk++;
 	}

 	*str = walk;
-	return 1;
+	return true;
 }
-/* }}} */

 /* Return NULL if an exception has occurred */
 static zend_string *preg_do_repl_func(zend_fcall_info *fci, zend_fcall_info_cache *fcc, const char *subject, PCRE2_SIZE *offsets, zend_string **subpat_names, uint32_t num_subpats, int count, const PCRE2_SPTR mark, zend_long flags)