3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MySessionStorage implements SessionHandlerInterface { private $path; function open($savePath, $sessionName) { $this->path = $savePath; } function close() { } function read($id) { return ''; } function write($id, $data) { return TRUE; } function destroy($id) { return TRUE; } function gc($maxlifetime) { return TRUE; } } if (session_set_save_handler(new MySessionStorage)){ $toto = session_start(); }
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Deprecated: Return type of MySessionStorage::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/ibcv4 on line 8 Deprecated: Return type of MySessionStorage::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/ibcv4 on line 13 Deprecated: Return type of MySessionStorage::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/ibcv4 on line 17 Deprecated: Return type of MySessionStorage::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/ibcv4 on line 22 Deprecated: Return type of MySessionStorage::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/ibcv4 on line 27 Deprecated: Return type of MySessionStorage::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/ibcv4 on line 32 Warning: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent in /in/ibcv4 on line 38
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 MySessionStorage::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/ibcv4 on line 8 Deprecated: Return type of MySessionStorage::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/ibcv4 on line 13 Deprecated: Return type of MySessionStorage::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/ibcv4 on line 17 Deprecated: Return type of MySessionStorage::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/ibcv4 on line 22 Deprecated: Return type of MySessionStorage::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/ibcv4 on line 27 Deprecated: Return type of MySessionStorage::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/ibcv4 on line 32 Warning: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent in /in/ibcv4 on line 38
Output for 8.0.0 - 8.0.30
Fatal error: Uncaught TypeError: Session callback must have a return value of type bool, null returned in /in/ibcv4:39 Stack trace: #0 /in/ibcv4(39): session_start() #1 {main} thrown in /in/ibcv4 on line 39
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: session_start(): Session callback expects true/false return value in /in/ibcv4 on line 39 Warning: session_start(): Session callback expects true/false return value in /in/ibcv4 on line 39 Warning: session_start(): Failed to initialize storage module: user (path: ) in /in/ibcv4 on line 39
Output for 7.1.0 - 7.1.33
Warning: session_start(): Session callback expects true/false return value in /in/ibcv4 on line 39 Warning: session_start(): Session callback expects true/false return value in /in/ibcv4 on line 39 Fatal error: session_start(): Failed to initialize storage module: user (path: ) in /in/ibcv4 on line 39
Process exited with code 255.
Output for 7.0.0 - 7.0.33
Warning: session_start(): Session callback expects true/false return value in /in/ibcv4 on line 39 Fatal error: session_start(): Failed to initialize storage module: user (path: ) in /in/ibcv4 on line 39 Warning: Unknown: Session callback expects true/false return value in Unknown on line 0
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40

preferences:
275.16 ms | 402 KiB | 330 Q