2003-06-02 02:35:29 +08:00
|
|
|
--TEST--
|
2003-07-25 01:07:40 +08:00
|
|
|
Bug #21478 (Zend/zend_alloc.c :: shutdown_memory_manager produces segfault)
|
2003-06-02 02:35:29 +08:00
|
|
|
--SKIPIF--
|
|
|
|
<?php
|
|
|
|
if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed');
|
2003-08-08 03:36:13 +08:00
|
|
|
if (!function_exists('stream_filter_register')) die('skip stream_filter_register() not available');
|
2003-06-02 02:35:29 +08:00
|
|
|
?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
class debugfilter extends php_user_filter {
|
|
|
|
function filter($in, $out, &$consumed, $closing) {
|
|
|
|
while ($bucket = stream_bucket_make_writeable($in)) {
|
|
|
|
$bucket->data = strtoupper($bucket->data);
|
|
|
|
stream_bucket_append($out, $bucket);
|
|
|
|
$consumed += strlen($bucket->data);
|
|
|
|
}
|
|
|
|
return PSFS_PASS_ON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stream_filter_register("myfilter","debugfilter");
|
|
|
|
|
2003-07-01 23:56:07 +08:00
|
|
|
$fp = fopen(dirname(__FILE__)."/test.txt","w");
|
2003-06-02 02:35:29 +08:00
|
|
|
stream_filter_append($fp, "myfilter");
|
|
|
|
stream_filter_append($fp, "myfilter");
|
|
|
|
stream_filter_append($fp, "myfilter");
|
|
|
|
fwrite($fp, "This is a test.\n");
|
|
|
|
print "Done.\n";
|
|
|
|
fclose($fp);
|
2014-11-20 03:59:31 +08:00
|
|
|
// Uncommenting the following 'print' line causes the segfault to stop occurring
|
2003-06-02 02:35:29 +08:00
|
|
|
// print "2\n";
|
2003-07-01 23:56:07 +08:00
|
|
|
readfile(dirname(__FILE__)."/test.txt");
|
|
|
|
unlink(dirname(__FILE__)."/test.txt");
|
2003-06-02 02:35:29 +08:00
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
Done.
|
|
|
|
THIS IS A TEST.
|