3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test implements SessionHandlerInterface { public function close() { return true; } public function destroy($session_id) { return true; } public function gc($maxlifetime) { return true; } public function open($save_path, $session_name) { return true; } public function read($session_id) { return 'testtest|s:7:"testing";'; } public function write($session_id, $session_data) { var_dump(session_status()); return true; } } $test = new Test(); session_set_save_handler($test); session_start(); session_write_close(); var_dump(PHP_SESSION_NONE ); var_dump(PHP_SESSION_ACTIVE );
based on 8mio5
Output for 7.1.0 - 7.3.0rc3
int(2) int(1) int(2)
Output for 5.6.4 - 5.6.30, 7.0.0 - 7.0.20
int(1) int(1) int(2)
Output for hhvm-3.15.4
Fatal error: Uncaught TypeError: Argument 2 passed to __SystemLib\session_set_save_handler() must be an instance of bool, null given in /in/3Z6NJ:38 Stack trace: #0 /in/3Z6NJ(38): session_set_save_handler() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.3
int(1) int(2)