#43546 [Opn->Bgs]: Strange behaviour after setting stream_set_blocking()

From: Date: Mon, 10 Dec 2007 09:41:53 +0000
Subject: #43546 [Opn->Bgs]: Strange behaviour after setting stream_set_blocking()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120515@lists.php.net to get a copy of this message
ID: 43546 Updated by: jani@php.net Reported By: martzy at gmail dot com -Status: Open +Status: Bogus Bug Type: Streams related Operating System: FreeBSD 6.2-RELEASE PHP Version: 5.2.5 New Comment: Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. See bug #34972 Previous Comments: ------------------------------------------------------------------------ [2007-12-09 20:33:54] martzy at gmail dot com Description: ------------ When running a PHP script as CLI, after setting stream_set_blocking($x,0), invoking an infinite loop which includes a print statement causes spontaneous script termination after an indeterminate number of iterations. Omitting stream_set_blocking() eliminates the problem. Tested and confirmed this behaviour on PHP 5.2.3 and PHP 5.2.5 on several FreeBSD systems. Reproduce code: --------------- This works as expected: <?php stream_set_blocking(STDIN,0); do { } while(TRUE); ?> However, after introducing a print statement to the loop, the script appears to spontaneously terminate after a number of iterations. <?php stream_set_blocking(STDIN,0); do { print "!"; } while(TRUE); ?> Expected result: ---------------- Script should loop indefinately. Actual result: -------------- Script terminates on it's own. Any code following the loop is not executed. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43546&edit=1

« previous php.bugs (#120515) next »