php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: martzy at gmail dot com
New email:
PHP Version: OS:

 

 [2007-12-09 20:33 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-10 09:41 UTC] jani@php.net
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: Thu Apr 25 13:01:30 2024 UTC