Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--TEST--
SessionHandlerInterface missing create_sid() emits deprecation
--FILE--
<?php

class MySessionHandler implements SessionHandlerInterface
{
public function open(string $path, string $name): bool
{
return true;
}

public function close(): bool
{
return true;
}

public function read(string $id): string|false
{
return '';
}

public function write(string $id, string $data): bool
{
return true;
}

public function destroy(string $id): bool
{
return true;
}

public function gc(int $max_lifetime): int|false
{
return 0;
}
}

?>
--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
8 changes: 4 additions & 4 deletions ext/session/tests/user_session_module/gh23328.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions ext/session/tests/user_session_module/gh9583-extra.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions ext/session/tests/user_session_module/gh9583.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading