<?php
class Handler implements SessionHandlerInterface {
private $savePath;
public function open($savePath, $sessionName) {
return true;
}
public function close() {
return true;
}
public function read($id) {
return null; // Error: Should return an empty string if no record is found
}
public function write($id, $data) {
return true;
}
public function destroy($id) {
return true;
}
public function gc($maxlifetime) {
return true;
}
}
session_set_save_handler(new Handler());
session_start();
Deprecated: Return type of Handler::open($savePath, $sessionName) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 5
Deprecated: Return type of Handler::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 9
Deprecated: Return type of Handler::read($id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 13
Deprecated: Return type of Handler::write($id, $data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 17
Deprecated: Return type of Handler::destroy($id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 21
Deprecated: Return type of Handler::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 25
Warning: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent in /in/Olh8p on line 30
Warning: session_start(): Session cannot be started after headers have already been sent in /in/Olh8p on line 31
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Deprecated: Return type of Handler::open($savePath, $sessionName) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 5
Deprecated: Return type of Handler::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 9
Deprecated: Return type of Handler::read($id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 13
Deprecated: Return type of Handler::write($id, $data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 17
Deprecated: Return type of Handler::destroy($id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 21
Deprecated: Return type of Handler::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Olh8p on line 25
Warning: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent in /in/Olh8p on line 30
Warning: session_start(): Session cannot be started after headers have already been sent in /in/Olh8p on line 31