1--TEST-- 2Bug #21478 (Zend/zend_alloc.c :: shutdown_memory_manager produces segfault) 3--FILE-- 4<?php 5class debugfilter extends php_user_filter { 6 function filter($in, $out, &$consumed, $closing) { 7 while ($bucket = stream_bucket_make_writeable($in)) { 8 $bucket->data = strtoupper($bucket->data); 9 stream_bucket_append($out, $bucket); 10 $consumed += strlen($bucket->data); 11 } 12 return PSFS_PASS_ON; 13 } 14} 15 16stream_filter_register("myfilter","debugfilter"); 17 18$fp = fopen(__DIR__."/test.txt","w"); 19stream_filter_append($fp, "myfilter"); 20stream_filter_append($fp, "myfilter"); 21stream_filter_append($fp, "myfilter"); 22fwrite($fp, "This is a test.\n"); 23print "Done.\n"; 24fclose($fp); 25// Uncommenting the following 'print' line causes the segfault to stop occurring 26// print "2\n"; 27readfile(__DIR__."/test.txt"); 28unlink(__DIR__."/test.txt"); 29?> 30--EXPECT-- 31Done. 32THIS IS A TEST. 33