5454#include "mod_mm.h"
5555#endif
5656
57+ #include "zend_attributes.h"
58+
5759PHPAPI ZEND_DECLARE_MODULE_GLOBALS (ps )
5860
5961static zend_result php_session_rfc1867_callback (unsigned int event , void * event_data , void * * extra );
@@ -1502,6 +1504,8 @@ PHPAPI zend_result php_session_reset_id(void)
15021504 /* zend_hash_str_del(EG(zend_constants), ZEND_STRL("sid")); */
15031505 sid = zend_get_constant_str (ZEND_STRL ("SID" ));
15041506
1507+ zend_constant * new_sid_constant = NULL ;
1508+
15051509 if (PS (define_sid )) {
15061510 smart_str var = {0 };
15071511
@@ -1513,17 +1517,25 @@ PHPAPI zend_result php_session_reset_id(void)
15131517 zval_ptr_dtor (sid );
15141518 ZVAL_STR (sid , smart_str_extract (& var ));
15151519 } else {
1516- REGISTER_STRINGL_CONSTANT ("SID" , ZSTR_VAL (var .s ), ZSTR_LEN (var .s ), CONST_DEPRECATED );
1520+ new_sid_constant = REGISTER_STRINGL_CONSTANT ("SID" , ZSTR_VAL (var .s ), ZSTR_LEN (var .s ), CONST_DEPRECATED );
15171521 smart_str_free (& var );
15181522 }
15191523 } else {
15201524 if (sid ) {
15211525 zval_ptr_dtor (sid );
15221526 ZVAL_EMPTY_STRING (sid );
15231527 } else {
1524- REGISTER_STRINGL_CONSTANT ("SID" , "" , 0 , CONST_DEPRECATED );
1528+ new_sid_constant = REGISTER_STRINGL_CONSTANT ("SID" , "" , 0 , CONST_DEPRECATED );
15251529 }
15261530 }
1531+ if (new_sid_constant != NULL ) {
1532+ zend_string * deprecation_reason = zend_string_init ("as GET/POST sessions were deprecated" , strlen ("as GET/POST sessions were deprecated" ), 1 );
1533+ zend_attribute * deprecation_attrib = zend_add_global_constant_attribute (new_sid_constant , ZSTR_KNOWN (ZEND_STR_DEPRECATED_CAPITALIZED ), 2 );
1534+ ZVAL_STR (& deprecation_attrib -> args [0 ].value , ZSTR_KNOWN (ZEND_STR_8_DOT_4 ));
1535+ deprecation_attrib -> args [0 ].name = ZSTR_KNOWN (ZEND_STR_SINCE );
1536+ ZVAL_STR (& deprecation_attrib -> args [1 ].value , deprecation_reason );
1537+ deprecation_attrib -> args [1 ].name = ZSTR_KNOWN (ZEND_STR_MESSAGE );
1538+ }
15271539
15281540 /* Apply trans sid if sid cookie is not set */
15291541 apply_trans_sid = 0 ;
0 commit comments