|  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
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
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
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:

Test script:

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...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-09 14:14 UTC]
-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]
Is this still an issue with any of the actively supported PHP

[1] <>
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 17:01:33 2024 UTC