@ 2016-09-30T05:45:51Z <?php
class Intercept extends php_user_filter
{
public static $cache = '';
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
self::$cache .= $bucket->data;
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
}
$out = fwrite(STDOUT, "Hello\n");
var_dump($out);
stream_filter_register("intercept_filter", "Intercept");
stream_filter_append(STDOUT, "intercept_filter");
$out = fwrite(STDOUT, "Goodbye\n");
var_dump($out);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Deprecated: Return type of Intercept::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/fMHZu on line 6
Hello
int(6)
Goodbye
int(8)
Output for 7.0.13 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 Hello
int(6)
Goodbye
int(8)
Output for 7.0.12 Hello
int(6)
Goodbye
int(139833530314920)
Output for 7.0.11 Hello
int(6)
Goodbye
int(140572818337960)
Output for 7.0.10 Hello
int(6)
Goodbye
int(139799862636712)
Output for 7.0.9 Hello
int(6)
Goodbye
int(140395510321320)
Output for 7.0.8 Hello
int(6)
Goodbye
int(140014432637096)
Output for 7.0.7 Hello
int(6)
Goodbye
int(139795844386984)
Output for 7.0.6 Hello
int(6)
Goodbye
int(139737440800936)
Output for 7.0.5 Hello
int(6)
Goodbye
int(140145508831400)
Output for 7.0.4 Hello
int(6)
Goodbye
int(139801317953704)
Output for 7.0.3 Hello
int(6)
Goodbye
int(140623248445608)
Output for 7.0.2 Hello
int(6)
Goodbye
int(140142683967656)
Output for 7.0.1 Hello
int(6)
Goodbye
int(140625546924200)
Output for 7.0.0 Hello
int(6)
Goodbye
int(140008143278248)
Output for 5.6.0 - 5.6.16 , 5.6.18 - 5.6.33 , 5.6.35 - 5.6.40 Hello
int(6)
Goodbye
int(8)
Process exited with code 139 . Output for 5.6.17 , 5.6.34 Hello
int(6)
Goodbye
int(8)
Process exited with code 135 . preferences:dark mode live preview
234.24 ms | 401 KiB | 291 Q