1--TEST-- 2Bug #72941 (Modifying bucket->data by-ref has no effect any longer) 3--FILE-- 4<?php 5class rotate_filter_nw extends php_user_filter 6{ 7 function filter($in, $out, &$consumed, $closing): int 8 { 9 while ($bucket = stream_bucket_make_writeable($in)) { 10 $this->rotate($bucket->data); 11 $consumed += $bucket->datalen; 12 stream_bucket_prepend($out, $bucket); 13 } 14 15 return PSFS_PASS_ON; 16 } 17 18 function rotate(&$data) 19 { 20 $n = strlen($data); 21 for ($i = 0; $i < $n - 1; ++$i) { 22 $data[$i] = $data[$i + 1]; 23 } 24 } 25} 26 27stream_filter_register("rotator_notWorking", rotate_filter_nw::class); 28$stream = fopen('php://memory', 'w+'); 29fwrite($stream, 'hello, world'); 30rewind($stream); 31stream_filter_append($stream, "rotator_notWorking"); 32var_dump(stream_get_contents($stream)); 33?> 34--EXPECT-- 35string(12) "ello, worldd" 36