3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class StreamFilter extends php_user_filter { public function filter($in, $out, &$consumed, $closing) { var_dump('FILTERING!'); while ($bucket = stream_bucket_make_writeable($in)) ; if ($closing || feof($this->stream)) { $streamUri = substr(stream_get_meta_data($this->stream)['uri'], strlen('php://filter/read=asd/resource=')); //$buffer = strtoupper(file_get_contents($streamUri)); $buffer = 'HA'; $bucket = stream_bucket_new($this->stream, $buffer); stream_bucket_append($out, $bucket); return PSFS_PASS_ON; } return PSFS_FEED_ME; } } stream_filter_register('asd', 'StreamFilter'); function shut() { $stream = 'php://filter/read=asd/resource=/home/vagrant/test-register-shutdown-function/test.txt'; $stream = 'php://filter/read=asd/resource=https://dirty.ru/robots.txt'; var_dump(file_get_contents($stream)); //$stream = 'php://filter/read=string.toupper/resource=/home/vagrant/test-register-shutdown-function/test.txt'; //var_dump(file_get_contents($stream)); } register_shutdown_function('shut'); /* class A { public function __destruct() { } } new A(); */ die;
based on C0G6I
Output for 5.4.15 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.2.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/Yjm5O on line 34 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/Yjm5O on line 34 Warning: file_get_contents(php://filter/read=asd/resource=https://dirty.ru/robots.txt): failed to open stream: operation failed in /in/Yjm5O on line 34 bool(false)
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/Yjm5O on line 34 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/Yjm5O on line 34 Warning: file_get_contents(php://filter/read=asd/resource=https://dirty.ru/robots.txt): failed to open stream: operation failed in /in/Yjm5O on line 34 bool(false)
Output for 5.4.12 - 5.4.14
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Yjm5O on line 34 Warning: file_get_contents(php://filter/read=asd/resource=https://dirty.ru/robots.txt): failed to open stream: operation failed in /in/Yjm5O on line 34 bool(false)
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/Yjm5O on line 12
Process exited with code 255.