From 48bed017f1a94d6ccbdb1d9c68d3ae83e28a65d3 Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Thu, 3 Sep 2026 07:42:07 +0530 Subject: [PATCH 1/2] ext/session:Fix session handler missing create_sid() diagnostic level --- ext/session/session.c | 4 +- ...n_handlerinterface_missing_create_sid.phpt | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 ext/session/tests/session_handlerinterface_missing_create_sid.phpt diff --git a/ext/session/session.c b/ext/session/session.c index 6a9f2b355c12..bf435dfbdf5f 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -2953,13 +2953,13 @@ static bool session_interfaces_include(const zend_class_entry *ce, const zend_cl static int session_handler_interface_gets_implemented(zend_class_entry *self, zend_class_entry *class) { if (!zend_hash_str_exists(&class->function_table, ZEND_STRL("create_sid")) && !session_interfaces_include(class, php_session_id_iface_entry)) { - zend_error(E_WARNING, + zend_error(E_DEPRECATED, "Class %s implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0", ZSTR_VAL(class->name)); } if (!zend_hash_str_exists(&class->function_table, ZEND_STRL("validateid")) && !session_interfaces_include(class, php_session_update_timestamp_iface_entry)) { - zend_error(E_WARNING, + zend_error(E_DEPRECATED, "Class %s implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0", ZSTR_VAL(class->name)); } diff --git a/ext/session/tests/session_handlerinterface_missing_create_sid.phpt b/ext/session/tests/session_handlerinterface_missing_create_sid.phpt new file mode 100644 index 000000000000..dbced3ee8d8b --- /dev/null +++ b/ext/session/tests/session_handlerinterface_missing_create_sid.phpt @@ -0,0 +1,43 @@ +--TEST-- +SessionHandlerInterface missing create_sid() emits deprecation +--FILE-- + +--EXPECTF-- +Deprecated: Class MySessionHandler implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d + +Deprecated: Class MySessionHandler implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d From 893a2297aa1776f2bf4958bab9eb507e61fed4d1 Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Thu, 3 Sep 2026 07:45:30 +0530 Subject: [PATCH 2/2] ext/session:Fix session handler missing create_sid() diagnostic level --- ext/session/tests/user_session_module/gh23328.phpt | 8 ++++---- ext/session/tests/user_session_module/gh9583-extra.phpt | 4 ++-- ext/session/tests/user_session_module/gh9583.phpt | 4 ++-- .../session_set_save_handler_iface_001.phpt | 4 ++-- .../session_set_save_handler_iface_003.phpt | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/session/tests/user_session_module/gh23328.phpt b/ext/session/tests/user_session_module/gh23328.phpt index c23ccb1de389..6885a13708e7 100644 --- a/ext/session/tests/user_session_module/gh23328.phpt +++ b/ext/session/tests/user_session_module/gh23328.phpt @@ -22,11 +22,11 @@ abstract class MissingCreateSid implements SessionHandlerInterface, SessionUpdat echo "Done\n"; ?> --EXPECTF-- -Warning: Class MissingBoth implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class MissingBoth implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d -Warning: Class MissingBoth implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class MissingBoth implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d -Warning: Class MissingValidateId implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class MissingValidateId implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d -Warning: Class MissingCreateSid implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class MissingCreateSid implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d Done diff --git a/ext/session/tests/user_session_module/gh9583-extra.phpt b/ext/session/tests/user_session_module/gh9583-extra.phpt index d82e0d8b2f0b..0664f7904eaf 100644 --- a/ext/session/tests/user_session_module/gh9583-extra.phpt +++ b/ext/session/tests/user_session_module/gh9583-extra.phpt @@ -45,9 +45,9 @@ var_dump($originalSessionId == $newSessionId); ?> --EXPECTF-- -Warning: Class SessionHandlerTester implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class SessionHandlerTester implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d -Warning: Class SessionHandlerTester implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class SessionHandlerTester implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d Deprecated: session_set_save_handler(): Providing an object to argument #1 ($sessionhandler) which does not have the create_sid() method defined is deprecated in %s on line %d diff --git a/ext/session/tests/user_session_module/gh9583.phpt b/ext/session/tests/user_session_module/gh9583.phpt index 040c2103d1e4..56524e46219a 100644 --- a/ext/session/tests/user_session_module/gh9583.phpt +++ b/ext/session/tests/user_session_module/gh9583.phpt @@ -40,9 +40,9 @@ echo "\n"; ?> --EXPECTF-- -Warning: Class SessionHandlerTester implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class SessionHandlerTester implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d -Warning: Class SessionHandlerTester implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class SessionHandlerTester implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d Deprecated: session_set_save_handler(): Providing an object to argument #1 ($sessionhandler) which does not have the create_sid() method defined is deprecated in %s on line %d diff --git a/ext/session/tests/user_session_module/session_set_save_handler_iface_001.phpt b/ext/session/tests/user_session_module/session_set_save_handler_iface_001.phpt index 023680c4a5d4..4594d5c4931c 100644 --- a/ext/session/tests/user_session_module/session_set_save_handler_iface_001.phpt +++ b/ext/session/tests/user_session_module/session_set_save_handler_iface_001.phpt @@ -83,9 +83,9 @@ session_unset(); --EXPECTF-- *** Testing session_set_save_handler() function: interface *** -Warning: Class MySession2 implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class MySession2 implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in %s on line %d -Warning: Class MySession2 implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class MySession2 implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d string(%d) "%s" diff --git a/ext/session/tests/user_session_module/session_set_save_handler_iface_003.phpt b/ext/session/tests/user_session_module/session_set_save_handler_iface_003.phpt index 66a813fa6637..3a66c88a36cc 100644 --- a/ext/session/tests/user_session_module/session_set_save_handler_iface_003.phpt +++ b/ext/session/tests/user_session_module/session_set_save_handler_iface_003.phpt @@ -73,7 +73,7 @@ var_dump($_SESSION); --EXPECTF-- *** Testing session_set_save_handler() function: id interface *** -Warning: Class MySession2 implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d +Deprecated: Class MySession2 implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in %s on line %d Deprecated: session_set_save_handler(): Providing an object to argument #1 ($sessionhandler) which does not have the validateId() method defined is deprecated in %s on line %d string(34) "session_set_save_handler_iface_003"