php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62583 socket_read(, , PHP_BINARY_READ) never returns FALSE when client disconnects
Submitted: 2012-07-16 21:16 UTC Modified: 2021-09-19 04:22 UTC
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: cmb (profile)
Status: No Feedback Package: Sockets related
PHP Version: 5.3.14 OS: Win32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zyss at mail dot zp dot ua
New email:
PHP Version: OS:

 

 [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

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-09 14:14 UTC] cmb@php.net
-Summary: socket_read(, , PHP_BINARY_READ) never ruturns FALSE when client disconnects +Summary: socket_read(, , PHP_BINARY_READ) never returns FALSE when client disconnects -Status: Open +Status: Feedback -Package: *General Issues +Package: Sockets related -Assigned To: +Assigned To: cmb
 [2021-09-09 14:14 UTC] cmb@php.net
Is this still an issue with any of the actively supported PHP
versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-09-19 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Aug 09 10:05:43 2022 UTC