File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / streams / bug60455_04.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:44 2012 UTC (12 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--TEST--
Bug #60455: stream_get_line and 1-line with maxlen size followed by 0-length
read with EOL indication
--FILE--
<?php
class TestStream {
	private $s = 0;
	function stream_open($path, $mode, $options, &$opened_path) {
	        return true;
	}
	function stream_read($count) {
		if ($this->s++ == 0)
			return "a\n";
		
		return "";
	}
	function stream_eof() {
		return $this->s >= 2;
	}
	
}

stream_wrapper_register("test", "TestStream");

$f = fopen("test://", "r");
while (!feof($f)) {
    $line = stream_get_line($f, 2, "\n");
    var_dump($line);
}
--EXPECT--
string(1) "a"
bool(false)

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