php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62583 socket_read(, , PHP_BINARY_READ) never ruturns FALSE when client disconnects
Submitted: 2012-07-16 21:16 UTC Modified: -
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: zyss at mail dot zp dot ua Assigned:
Status: Open Package: *General Issues
PHP Version: 5.3.14 OS: Win32
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-07-16 21:16 UTC] zyss at mail dot zp dot ua
Description:
------------
It seems that there is a long-lasting bug in PHP that prevents socket_read (called on a server-side socket returned from socket_accept()) to return false when TCP connection is closed (no matter how - gracefully or not).

Here this bug is mention also: http://stackoverflow.com/questions/9085615/php-detecting-remote-host-disconnection

Test script:
---------------
https://github.com/zyura/PHPSrv/blob/master/tcpserver.php

Expected result:
----------------
socket_read() returns FALSE when client disconnects and socket_last_error() returns adequate error code.

Actual result:
--------------
when client disconnects socket_read() always return empty string '' keeping client socket forever...

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Aug 20 13:01:27 2019 UTC