Annotation of embedaddon/php/ext/standard/tests/streams/bug60455_02.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Bug #60455: stream_get_line and 1-line followed by eol input
                      3: --FILE--
                      4: <?php
                      5: class TestStream {
                      6:        private $s = 0;
                      7:        function stream_open($path, $mode, $options, &$opened_path) {
                      8:                return true;
                      9:        }
                     10:        function stream_read($count) {
                     11:                if ($this->s++ == 0)
                     12:                        return "a\n";
                     13:                
                     14:                return "";
                     15:        }
                     16:        function stream_eof() {
                     17:                return $this->s >= 2;
                     18:        }
                     19:        
                     20: }
                     21: 
                     22: stream_wrapper_register("test", "TestStream");
                     23: 
                     24: $f = fopen("test://", "r");
                     25: while (!feof($f)) {
                     26:     $line = stream_get_line($f, 99, "\n");
                     27:     var_dump($line);
                     28: }
                     29: --EXPECT--
                     30: string(1) "a"
1.1.1.2 ! misho      31: bool(false)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>