Return to bug60817.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / streams |
1.1 misho 1: --TEST-- 2: Bug #60817: stream_get_line() reads from stream even when there is already sufficient data buffered 3: --FILE-- 4: <?php 5: class TestStream { //data, empty data, empty data + eof 6: private $s = 0; 7: function stream_open($path, $mode, $options, &$opened_path) { 8: return true; 9: } 10: function stream_read($count) { 11: echo "Read done\n"; 12: if ($this->s++ == 0) 13: return "a\nbb\ncc"; 14: 15: return ""; 16: } 17: function stream_eof() { 18: return $this->s >= 2; 19: } 20: 21: } 22: 23: stream_wrapper_register("test", "TestStream"); 24: 25: $f = fopen("test://", "r"); 26: while (!feof($f)) { 27: $line = stream_get_line($f, 99, "\n"); 28: var_dump($line); 29: } 30: 31: --EXPECT-- 32: Read done 33: string(1) "a" 34: string(2) "bb" 35: Read done 36: string(2) "cc"