Commit 90b43f04bf3 for php.net
commit 90b43f04bf377584913206670e2c49e3f037cf09
Author: Lazizbek Ergashev <lazerg2@gmail.com>
Date: Wed Aug 19 00:47:59 2026 +0500
Fix GH-23056: missing handler name in session write warning (#23059)
Closes GH-23056
diff --git a/ext/session/session.c b/ext/session/session.c
index e745a628767..6a9f2b355c1 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -531,7 +531,10 @@ static void php_session_save_current_state(bool write)
&& zend_string_equals(val, PS(session_vars))
) {
ret = PS(mod)->s_update_timestamp(&PS(mod_data), PS(id), val, PS(gc_maxlifetime));
- handler_function = &PS(mod_user_names).ps_update_timestamp;
+ /* The user handler falls back to the write handler if no update timestamp handler is set */
+ if (!Z_ISUNDEF(PS(mod_user_names).ps_update_timestamp)) {
+ handler_function = &PS(mod_user_names).ps_update_timestamp;
+ }
} else {
ret = PS(mod)->s_write(&PS(mod_data), PS(id), val, PS(gc_maxlifetime));
}
diff --git a/ext/session/tests/user_session_module/gh23043.phpt b/ext/session/tests/user_session_module/gh23043.phpt
index dc367699390..e3528884a79 100644
--- a/ext/session/tests/user_session_module/gh23043.phpt
+++ b/ext/session/tests/user_session_module/gh23043.phpt
@@ -27,9 +27,9 @@ function create_sid(): string {
Warning: SessionHandler::write(): Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, "-", and "," characters are allowed in %s on line %d
-Warning: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: , handler: ) in %s on line %d
+Warning: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: , handler: a::write) in %s on line %d
string(0) ""
Warning: SessionHandler::write(): Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, "-", and "," characters are allowed in Unknown on line 0
-Warning: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: , handler: ) in Unknown on line 0
+Warning: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: , handler: a::write) in Unknown on line 0