ID:               33471
 Comment by:       alonsoalonsocr at yahoo dot com
 Reported By:      info at goldenelite dot com
 Status:           No Feedback
 Bug Type:         Sockets related
 Operating System: FreeBSD 4.10
 PHP Version:      5.0.4
 New Comment:

this bug exists in 5.2.9 on Linux (either documentation has still not
been fixed, or function does not respect blocking or timout setting. I
should add that setting a read timeout with socket_set_option has no
effect, it still blocks forever when using PHP_NORMAL_READ


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

[2007-08-20 00:04:43] piro at pirocast dot net

bug still exists as of PHP 5.2.4

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

[2005-07-04 01:00:04] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

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

[2005-06-26 13:14:04] sni...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



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

[2005-06-25 07:36:17] info at goldenelite dot com

Description:
------------
The socker_read function has two modes: PHP_BINARY_READ and
PHP_NORMAL_READ. The latter is useful to get lines instead of raw data.
But using it will result in a blocked socket, regardless of
socket_set_nonblock() has been used.

I'm not sure this is a bug. If it is not, the manual page should
mention that the socket_read function would block regardless of blocking
mode if the PHP_NORMAL_READ parameter is used.

Reproduce code:
---------------
// short example
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_nonblock($socket);
socket_connect($socket, $host, $port);
$data = socket_read($socket, 512, PHP_NORMAL_READ);

Expected result:
----------------
Let's assume no data is transmitted by the remote host, thus no data is
to be received. Since we set non-blocking mode, the socket_read function
should produce a socket error very quickly and the script execution
continues.

Actual result:
--------------
Instead of continuing script execution, the socket_read function blocks
the further execution, waiting for data to be read until its buffer is
full. Thus it shows the effect of blocking mode, even though we
explicitly set to non blocking mode.


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


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

Reply via email to