1--TEST-- 2Bug #22538 (filtered stream doesn't update file pointer) 3--FILE-- 4<?php 5function my_stream_copy_to_stream($fin, $fout) { 6 while (!feof($fin)) { 7 fwrite($fout, fread($fin, 4096)); 8 } 9} 10 11$size = 65536; 12 13do { 14 $path1 = sprintf("%s/%s%da", __DIR__, uniqid(), time()); 15 $path2 = sprintf("%s/%s%db", __DIR__, uniqid(), time()); 16} while ($path1 == $path2); 17 18$fp = fopen($path1, "w") or die("Can not open $path1\n"); 19$str = "abcdefghijklmnopqrstuvwxyz\n"; 20$str_len = strlen($str); 21$cnt = $size; 22while (($cnt -= $str_len) > 0) { 23 fwrite($fp, $str); 24} 25$cnt = $size - ($str_len + $cnt); 26fclose($fp); 27$fin = fopen($path1, "r") or die("Can not open $path1\n"); 28$fout = fopen($path2, "w") or die("Can not open $path2\n"); 29stream_filter_append($fout, "string.rot13"); 30my_stream_copy_to_stream($fin, $fout); 31fclose($fout); 32fclose($fin); 33var_dump($cnt); 34var_dump(filesize($path2)); 35var_dump(md5_file($path1)); 36var_dump(md5_file($path2)); 37unlink($path1); 38unlink($path2); 39?> 40--EXPECT-- 41int(65529) 42int(65529) 43string(32) "e10e3d1ae81b084b822e8592d019b57a" 44string(32) "931f0fbf8a72312e3bab9965b1d1081c" 45