3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FileSessionHandler { private $savePath; function open($savePath, $sessionName) { return true; } function close() { return true; } function read($id) { return 'lol|s:222:"1";lol2|s:1:"1";'; } function write($id, $data) { } function destroy($id) { } function gc($maxlifetime) { } } $handler = new FileSessionHandler(); session_set_save_handler( array($handler, 'open'), array($handler, 'close'), array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc') ); register_shutdown_function('session_write_close'); session_start(); var_dump($_SESSION);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: session_start(): Failed to decode session object. Session has been destroyed in /in/tWYcZ on line 50 Fatal error: Uncaught TypeError: Session callback must have a return value of type bool, null returned in /in/tWYcZ:50 Stack trace: #0 /in/tWYcZ(50): session_start() #1 {main} thrown in /in/tWYcZ on line 50
Process exited with code 255.
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: session_start(): Session callback expects true/false return value in /in/tWYcZ on line 50 Warning: session_start(): Session object destruction failed in /in/tWYcZ on line 50 Warning: session_start(): Failed to decode session object. Session has been destroyed in /in/tWYcZ on line 50 array(0) { }
Output for 7.0.0 - 7.0.20
Warning: session_start(): Session callback expects true/false return value in /in/tWYcZ on line 50 Warning: session_start(): Session object destruction failed in /in/tWYcZ on line 50 Warning: session_start(): Failed to decode session object. Session has been destroyed in /in/tWYcZ on line 50 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/tWYcZ:50) in /in/tWYcZ on line 50 array(0) { }
Output for 5.5.29 - 5.5.35, 5.6.13 - 5.6.28
Warning: session_start(): Failed to decode session object. Session has been destroyed in /in/tWYcZ on line 50 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/tWYcZ:50) in /in/tWYcZ on line 50 array(0) { }
Output for 5.5.24 - 5.5.28, 5.6.8 - 5.6.12
array(2) { ["lol"]=> NULL ["222:"1";lol2"]=> string(1) "1" }

preferences:
188.11 ms | 401 KiB | 179 Q