Skip to content

Commit 99bf26b

Browse files
committed
ext/session: add mod_user_uses_object_methods_as_handlers global
This solves the use case of knowing if the session handlers are methods of an object or individual handlers without relying on the now removed mod_user_names global.
1 parent dbb2864 commit 99bf26b

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

UPGRADING.INTERNALS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ PHP 8.6 INTERNALS UPGRADE NOTES
106106

107107
- ext/session:
108108
. php_session_flush() now returns a bool rather than a zend_result.
109+
. The mod_user_names global has been removed.
110+
. The mod_user_uses_object_methods_as_handlers global has been added,
111+
it indicates whether the session handlers are methods of an object or not.
109112
. Removed session_adapt_url().
110113
. PS_OPEN_ARGS is now defined as
111114
`void **mod_data, zend_string *save_path, zend_string *session_name`

ext/session/php_session.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ typedef struct _php_ps_globals {
184184

185185
bool mod_user_implemented;
186186
bool mod_user_is_open;
187+
bool mod_user_uses_object_methods_as_handlers;
187188
bool use_trans_sid; /* contains the INI value of whether to use trans-sid */
188189
} php_ps_globals;
189190

ext/session/session.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ static inline void php_rinit_session_globals(void)
118118
PS(set_handler) = false;
119119
PS(mod_data) = NULL;
120120
PS(mod_user_is_open) = false;
121+
PS(mod_user_uses_object_methods_as_handlers) = false;
121122
PS(define_sid) = true;
122123
PS(session_vars) = NULL;
123124
PS(module_number) = my_module_number;
@@ -2123,6 +2124,7 @@ PHP_FUNCTION(session_set_save_handler)
21232124
zend_string_release_ex(validate_sid_name, false);
21242125
zend_string_release_ex(update_timestamp_name, false);
21252126

2127+
PS(mod_user_uses_object_methods_as_handlers) = true;
21262128
if (register_shutdown) {
21272129
/* create shutdown function */
21282130
php_shutdown_function_entry shutdown_function_entry = {
@@ -2214,6 +2216,7 @@ PHP_FUNCTION(session_set_save_handler)
22142216
SESSION_SET_USER_HANDLER_PROCEDURAL_OPTIONAL(ps_validate_sid, validate_id_fci);
22152217
SESSION_SET_USER_HANDLER_PROCEDURAL_OPTIONAL(ps_update_timestamp, update_timestamp_fci);
22162218

2219+
PS(mod_user_uses_object_methods_as_handlers) = false;
22172220
RETURN_TRUE;
22182221
}
22192222

@@ -2843,6 +2846,7 @@ static PHP_GINIT_FUNCTION(ps)
28432846
ps_globals->default_mod = NULL;
28442847
ps_globals->mod_user_implemented = false;
28452848
ps_globals->mod_user_is_open = false;
2849+
ps_globals->mod_user_uses_object_methods_as_handlers = false;
28462850
ps_globals->session_vars = NULL;
28472851
ps_globals->set_handler = false;
28482852
ps_globals->session_started_filename = NULL;

0 commit comments

Comments
 (0)