Commit a2c6e6f66a0 for php.net

commit a2c6e6f66a0fdfe472d5aca83f89c59cc3e6e37d
Author: Gina Peter Banyard <girgias@php.net>
Date:   Thu Feb 5 17:32:48 2026 +0000

    ext/session: remove PS_ENCODE_VARS

    By moving the declaration of the variables inside PS_ENCODE_LOOP() macro.

diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 5b4d3db64f4..4c7c72f2ba1 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -285,26 +285,20 @@ PHPAPI zend_result php_session_reset_id(void);
 	}																\
 } while (0)

-
-#define PS_ENCODE_VARS 												\
-	zend_string *key;												\
-	zend_ulong num_key;													\
-	zval *struc;
-
 /* Do not use a return statement in `code` because that may leak memory.
  * Break out of the loop instead. */
 #define PS_ENCODE_LOOP(code) do {									\
 	zval _zv;														\
 	/* protect against user interference */							\
 	ZVAL_COPY(&_zv, Z_REFVAL(PS(http_session_vars)));				\
-	HashTable *_ht = Z_ARRVAL(_zv);									\
-	ZEND_HASH_FOREACH_KEY(_ht, num_key, key) {						\
+	ZEND_HASH_FOREACH_KEY(Z_ARRVAL(_zv), zend_ulong num_key, zend_string * key) { \
 		if (key == NULL) {											\
 			php_error_docref(NULL, E_WARNING,						\
 					"Skipping numeric key " ZEND_LONG_FMT, num_key);\
 			continue;												\
 		}															\
-		if ((struc = php_get_session_var(key))) {					\
+		zval *struc = php_get_session_var(key);						\
+		if (struc) {												\
 			code;		 											\
 		} 															\
 	} ZEND_HASH_FOREACH_END();										\
diff --git a/ext/session/session.c b/ext/session/session.c
index cd957369c5e..e57123166e2 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -567,8 +567,6 @@ static void php_session_save_current_state(bool write)

 static void php_session_normalize_vars(void)
 {
-	PS_ENCODE_VARS;
-
 	IF_SESSION_VARS() {
 		PS_ENCODE_LOOP(
 			if (Z_TYPE_P(struc) == IS_PTR) {
@@ -988,7 +986,6 @@ PS_SERIALIZER_ENCODE_FUNC(php_binary)
 {
 	smart_str buf = {0};
 	php_serialize_data_t var_hash;
-	PS_ENCODE_VARS;

 	PHP_VAR_SERIALIZE_INIT(var_hash);

@@ -1052,7 +1049,6 @@ PS_SERIALIZER_ENCODE_FUNC(php)
 	smart_str buf = {0};
 	php_serialize_data_t var_hash;
 	bool fail = false;
-	PS_ENCODE_VARS;

 	PHP_VAR_SERIALIZE_INIT(var_hash);