Return to bug60455_01.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / streams |
1.1 misho 1: --TEST-- 2: Bug #60455: stream_get_line and 1-line noeol input 3: --FILE-- 4: <?php 5: 6: //It's critical the read on the stream returns the input but doesn't set EOF 7: //flag the first time. This is why we need to use sockets. 8: 9: $domain = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' ? STREAM_PF_INET : STREAM_PF_UNIX); 10: $sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP) 11: or die("stream_socket_pair"); 12: fwrite($sockets[0], "a"); 13: stream_socket_shutdown($sockets[0], STREAM_SHUT_RDWR); 14: 15: $f = $sockets[1]; 16: while (!feof($f)) { 17: $line = stream_get_line($f, 99, "\n"); 18: var_dump($line); 19: } 20: --EXPECT-- 21: string(1) "a"