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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
49 - 19 = ?
Subscribe to this entry?

 
 [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 Mar 28 13:01:28 2024 UTC