3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Testing shutdown sequence function checkSqlite() { if (!$GLOBALS['pdo']) echo "PDO connection\n"; } $pdo = new PDO('sqlite:memory'); function shutdown() { checkSqlite(); echo "register_shutdown_function\n"; } register_shutdown_function('shutdown'); class MyClass { function __destruct() { checkSqlite(); echo "Object destructor\n"; } } function obcallback($buffer) { checkSqlite(); $buffer .= "Output buffer callback\n"; return $buffer; } ob_start('obcallback'); $myObject = new MyClass; function dummy() { return true; } function sessionclose() { checkSqlite(); echo "Session close\n"; return true; } function sessionwrite() { checkSqlite(); echo "Session write\n"; return true; } session_set_save_handler('dummy','sessionclose','dummy','sessionwrite','dummy','dummy'); session_start(); ?>
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught PDOException: PDO::__construct(): open_basedir restriction in effect. File(/memory) is not within the allowed path(s): (/tmp:/in:/etc) in /in/mcl9B:10 Stack trace: #0 /in/mcl9B(10): PDO->__construct('sqlite:memory') #1 {main} Next PDOException: open_basedir prohibits opening memory in /in/mcl9B:10 Stack trace: #0 /in/mcl9B(10): PDO->__construct('sqlite:memory') #1 {main} thrown in /in/mcl9B on line 10
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33, 8.0.13
Fatal error: Uncaught PDOException: SQLSTATE[HY000] [14] unable to open database file in /in/mcl9B:10 Stack trace: #0 /in/mcl9B(10): PDO->__construct('sqlite:memory') #1 {main} thrown in /in/mcl9B on line 10
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Warning: PDO::__construct(): open_basedir restriction in effect. File(/memory) is not within the allowed path(s): (/tmp:/in:/etc) in /in/mcl9B on line 10 Fatal error: Uncaught exception 'PDOException' with message 'open_basedir prohibits opening memory' in /in/mcl9B:10 Stack trace: #0 /in/mcl9B(10): PDO->__construct('sqlite:memory') #1 {main} thrown in /in/mcl9B on line 10
Process exited with code 255.

preferences:
267.18 ms | 402 KiB | 330 Q