3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $bucket = stream_bucket_new(fopen('php://temp', 'w+'), ''); class bucketFilter { public function filter($in, $out, &$consumed, $closing ){ $bucket = stream_bucket_new(fopen('php://temp', 'w+'), 'FOO'); stream_bucket_append($out, $bucket); return PSFS_PASS_ON; } } stream_filter_register('bucketfault', 'bucketFilter'); stream_filter_append($s = fopen('php://temp', 'r+'), 'bucketfault'); stream_get_contents($s); echo "Done\n";
Output for 5.1.4 - 5.6.28, 7.0.0 - 7.1.0
Done
Output for hhvm-3.10.0 - 3.12.0
Fatal error: Unknown method bucketFilter::onCreate in /in/OYCXS on line 15
Process exited with code 255.
Output for 5.0.0 - 5.1.3
Warning: fopen(php://temp): failed to open stream: Inappropriate ioctl for device in /in/OYCXS on line 3 Warning: stream_bucket_new(): supplied argument is not a valid stream resource in /in/OYCXS on line 3 Warning: fopen(php://temp): failed to open stream: Inappropriate ioctl for device in /in/OYCXS on line 15 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/OYCXS on line 15 Warning: stream_get_contents() expects parameter 1 to be resource, boolean given in /in/OYCXS on line 16 Done
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/OYCXS on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/OYCXS on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/OYCXS on line 6
Process exited with code 255.