ID:               19944
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Feedback
 Bug Type:         Sockets related
 Operating System: RedHat 7.3
 PHP Version:      4.3.0-pre1
 New Comment:

As an aside:
you can use stream_select() to acheive this (see docs for
socket_select; they work the same way, but on different things).
Also, you should use if ($string !== false) to 100% correct in your
script.


Previous Comments:
------------------------------------------------------------------------

[2002-10-17 17:07:37] [EMAIL PROTECTED]

Try this one again: http://snaps.php.net/php4-latest.tar.bz2
You might have got the snapshot which didn't have the fixes.



------------------------------------------------------------------------

[2002-10-17 12:52:36] [EMAIL PROTECTED]

I just tried with the latest from snaps.php.net.  Problem still exists
as of php4-200210170600.

------------------------------------------------------------------------

[2002-10-17 02:15:13] [EMAIL PROTECTED]

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

Use a snapshot from 
http://snaps.php.net/php4-latest.tar.bz2
fgets had some real nasty problems.

------------------------------------------------------------------------

[2002-10-16 23:32:19] [EMAIL PROTECTED]

I am trying to use the CLI version of 4.3.0-pre1.  My script needs to
act if there hasn't been input within a certain amount of time.  I've
used the following function to accomplish this with TCP/IPsockets in
non-blocking mode:

function GetSocketLine($socket, $timeout)
{
 $timeout += time();
 $holdString = "";
 while(time() < $timeout)
  {
  $string = fgets($socket, 1024);
  if($string != false)
    break;
  }
 return($string);
}

However, if I use set_stream_blocking() to set STDIN to non-blocking,
the above code returns garbage instead of "false" when there is nothing
to receive.  It would seem to me that if STDIN is set to non-blocking
and STDIN is passed to the above function as $socket, it ought to
return "false" when blocking would occur--it shouldn't return garbage.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=19944&edit=1

Reply via email to