3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * noop filter class for demonstration */ class stream_sigsegv extends php_user_filter { /** * @var resource */ private $filterHandle; /** * @param resource $filterHandle */ public function __construct($filterHandle) { $this->filterHandle = $filterHandle; } /** * @return int */ public function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); } return PSFS_PASS_ON; } public function __destruct() { if (is_resource($this->filterHandle)) { stream_filter_remove($this->filterHandle); } } } $filterName = $filterClass = 'stream_sigsegv'; stream_filter_register($filterName, $filterClass); $handle = fopen('php://temp', 'rb'); $filterHandle = stream_filter_append($handle, $filterName, STREAM_FILTER_READ); assert(false !== $filterHandle, 'append filter success'); $foo = new stream_sigsegv($filterHandle); fclose($handle); # Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
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 stream_sigsegv::filter($in, $out, &$consumed, $closing) should either be compatible with php_user_filter::filter($in, $out, &$consumed, bool $closing): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/QR6ev on line 24
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 stream_sigsegv::filter($in, $out, &$consumed, $closing) should either be compatible with php_user_filter::filter($in, $out, &$consumed, bool $closing): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/QR6ev on line 24
Output for 7.2.30 - 7.2.34, 7.3.18 - 7.3.33, 7.4.6 - 7.4.33, 8.0.0 - 8.0.30
Output for 7.2.0 - 7.2.29, 7.3.0 - 7.3.17, 7.4.0 - 7.4.5

Process exited with code 139.

preferences:
154.63 ms | 402 KiB | 184 Q