3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DemoBugSessionHandler implements SessionHandlerInterface { public function open($save_path, $name) { return true; } /** * Read session data * @link https://php.net/manual/en/sessionhandlerinterface.read.php * @param string $session_id The session id to read data for. * @return string <p> * Returns an encoded string of the read data. * If nothing was read, it must return an empty string. * Note this value is returned internally to PHP for processing. * </p> * @since 5.4.0 */ public function read($session_id) { // Simulate a session ID regeneration. \session_id('newsessionid'); return ''; } /** * Write session data * @link https://php.net/manual/en/sessionhandlerinterface.write.php * @param string $session_id The session id. * @param string $session_data <p> * The encoded session data. This data is the * result of the PHP internally encoding * the $_SESSION superglobal to a serialized * string and passing it as this parameter. * Please note sessions use an alternative serialization method. * </p> * @return bool <p> * The return value (usually TRUE on success, FALSE on failure). * Note this value is returned internally to PHP for processing. * </p> * @since 5.4.0 */ public function write($session_id, $session_data) { // Print back to the user agent the $session_id // that is going to be persisted when the script finishes. echo $session_id . PHP_EOL; return true; } public function destroy($session_id) { return true; } public function close() { return true; } public function gc($maxlifetime) { return true; } } session_set_save_handler(new \DemoBugSessionHandler(), true); session_start();
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of DemoBugSessionHandler::open($save_path, $name) 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/6S4XM on line 5 Deprecated: Return type of DemoBugSessionHandler::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/6S4XM on line 61 Deprecated: Return type of DemoBugSessionHandler::read($session_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/6S4XM on line 21 Deprecated: Return type of DemoBugSessionHandler::write($session_id, $session_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/6S4XM on line 46 Deprecated: Return type of DemoBugSessionHandler::destroy($session_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/6S4XM on line 56 Deprecated: Return type of DemoBugSessionHandler::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/6S4XM on line 66 Warning: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent in /in/6S4XM on line 72 Warning: session_start(): Session cannot be started after headers have already been sent in /in/6S4XM on line 74

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
61.37 ms | 405 KiB | 8 Q