Obtained from:	https://github.com/laruence/yaf/commit/b1d252c944a8d70f0dc28415b3d67a7b3bbbf7ce

--- routes/yaf_route_regex.c.orig	2024-06-25 03:13:57 UTC
+++ routes/yaf_route_regex.c
@@ -204,11 +204,18 @@ static int yaf_route_regex_match(yaf_route_regex_objec
 #if PHP_VERSION_ID < 70400
 		php_pcre_match_impl(pce_regexp, (char*)uri, len, &matches, &subparts /* subpats */,
 				0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
-#else
+#elif PHP_VERSION_ID < 80400
 		{
 			zend_string *tmp = zend_string_init(uri, len, 0);
 			php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */,
 					0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
+			zend_string_release(tmp);
+		}
+#else
+		{
+			zend_string *tmp = zend_string_init(uri, len, 0);
+			php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */,
+					0/* global */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
 			zend_string_release(tmp);
 		}
 #endif
--- routes/yaf_route_rewrite.c.orig	2024-06-25 03:13:57 UTC
+++ routes/yaf_route_rewrite.c
@@ -209,11 +209,18 @@ static int yaf_route_rewrite_match(yaf_route_rewrite_o
 #if PHP_VERSION_ID < 70400
 		php_pcre_match_impl(pce_regexp, (char*)uri, len, &matches, &subparts /* subpats */,
 				0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
-#else
+#elif PHP_VERSION_ID <80400
 		{
 			zend_string *tmp = zend_string_init(uri, len, 0);
 			php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */,
 					0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
+			zend_string_release(tmp);
+		}
+#else
+		{
+			zend_string *tmp = zend_string_init(uri, len, 0);
+			php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */,
+					0/* global */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
 			zend_string_release(tmp);
 		}
 #endif
