|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43546 Strange behaviour after setting stream_set_blocking()
Submitted: 2007-12-09 20:33 UTC Modified: 2007-12-10 09:41 UTC
From: martzy at gmail dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.5 OS: FreeBSD 6.2-RELEASE
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: martzy at gmail dot com
New email:
PHP Version: OS:


 [2007-12-09 20:33 UTC] martzy at gmail dot com
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:



do {

} while(TRUE);


However, after introducing a print statement to the loop, the script appears to spontaneously terminate after a number of iterations.



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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-10 09:41 UTC]
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
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 05:01:30 2024 UTC