From b7d66189cb7c9ed09bd3971fb50dd2c44ce9d3fc Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Tue, 26 Aug 2025 13:34:49 +0200 Subject: [PATCH] Fix RC violation of session SID constant deprecation attribute Don't use persistent string/attribute for the global SID constant, which is created at runtime and destroyed at the end of the request. Requires CFLAGS="-DZEND_RC_DEBUG=1" to reproduce. Closes GH-19595 --- NEWS | 2 ++ ext/session/session.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index fa94062bc99..c4e09090509 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 8.5.0beta3 +- Session: + . Fix RC violation of session SID constant deprecation attribute. (ilutov) 28 Aug 2025, PHP 8.5.0beta2 diff --git a/ext/session/session.c b/ext/session/session.c index a7a253d8bff..66912fb1016 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1529,8 +1529,8 @@ PHPAPI zend_result php_session_reset_id(void) } } if (new_sid_constant != NULL) { - zend_string *deprecation_reason = zend_string_init("as GET/POST sessions were deprecated", strlen("as GET/POST sessions were deprecated"), 1); - zend_attribute *deprecation_attrib = zend_add_global_constant_attribute(new_sid_constant, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); + zend_string *deprecation_reason = zend_string_init("as GET/POST sessions were deprecated", strlen("as GET/POST sessions were deprecated"), 0); + zend_attribute *deprecation_attrib = zend_add_attribute(&new_sid_constant->attributes, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2, 0, 0, 0); ZVAL_STR(&deprecation_attrib->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_4)); deprecation_attrib->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); ZVAL_STR(&deprecation_attrib->args[1].value, deprecation_reason);