Skip to content

SessionInterfaceHandler is throwing a deprecation notice as a warning instead of a deprecation #26001

Backlog

Description

@auroraeosrose

Description

"Class %s implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0",

static void 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,
			"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,
			"Class %s implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0",
			ZSTR_VAL(class->name));
	}
}

Found this after a PHP 8.5 -> 8.6 upgrade with 3rd party software - tried to filter out deprecation notices but this is coming up as an E_WARNING instead - and it should not be

Simply changing the E_WARNING to a deprecation level should fix the issue - it's annoying!

PHP Version

PHP 8.6.0 (cli) (built: Nov 20 2026 15:07:19) (NTS)
Copyright © The PHP Group and Contributors
Built by Ubuntu
Zend Engine v4.6.0, Copyright © Zend by Perforce
    with Zend OPcache v8.6.0, Copyright ©, by Zend by Perforce

Operating System

No response

Activity

  1. jorgsowa commented on Dec 6, 2026

    @jorgsowa
    Contributor

    Thank you for the report. The E_WARNING is intentional. The Deprecations for PHP 8.6 RFC defines two different diagnostics:

    • passing a handler without create_sid()/validateId() to session_set_save_handler() - E_DEPRECATED, because this usage will stop working in PHP 9.0;
    • implementing SessionHandlerInterface without these methods - E_WARNING, because the interface will require them in PHP 9.0.

    The warning also points at a real security problem. Without validateId(), the user handler accepts every session ID, so session.use_strict_mode (enabled by default since PHP 8.6) does nothing. If an attacker can set the session cookie (e.g. from a subdomain), PHP starts a session with the ID they chose instead of generating a new one. If the application doesn't call session_regenerate_id() after login, the attacker shares the victim's session. That's session fixation, which strict mode is meant to prevent.

    To get rid of the warning, add create_sid() and validateId() to the handler class, or implement SessionIdInterface and SessionUpdateTimestampHandlerInterface. You will need these methods in PHP 9.0 anyway. If the handler comes from a third-party package, please report it there.

    You are right that UPGRADING calls this "a deprecation". That's wrong, and #26116 fixes it. Changing the level to E_DEPRECATED (#26054) would go against the RFC vote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions