Return to bug35916.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / filters |
1.1 misho 1: --TEST-- 2: Bug #35916 (Duplicate calls to stream_bucket_append() lead to a crash) 3: --FILE-- 4: <?php 5: $file = dirname(__FILE__) . "/bug35916.txt"; 6: @unlink($file); 7: 8: class strtoupper_filter extends php_user_filter 9: { 10: function filter($in, $out, &$consumed, $closing) 11: { 12: while($bucket=stream_bucket_make_writeable($in)) { 13: $bucket->data = strtoupper($bucket->data); 14: $consumed += $bucket->datalen; 15: stream_bucket_append($out, $bucket); 16: stream_bucket_append($out, $bucket); 17: } 18: return PSFS_PASS_ON; 19: } 20: function onCreate() 21: { 22: echo "fffffffffff\n"; 23: } 24: function onClose() 25: { 26: echo "hello\n"; 27: } 28: } 29: 30: stream_filter_register("strtoupper", "strtoupper_filter"); 31: $fp=fopen($file, "w"); 32: stream_filter_append($fp, "strtoupper"); 33: fread($fp, 1024); 34: fwrite($fp, "Thank you\n"); 35: fclose($fp); 36: readfile($file); 37: unlink($file); 38: ?> 39: --EXPECT-- 40: fffffffffff 41: hello 42: THANK YOU