|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70813 connection_status(), connection_aborted() not working
Submitted: 2015-10-29 14:59 UTC Modified: 2015-10-29 15:11 UTC
Avg. Score:4.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: sivann at gmail dot com Assigned:
Status: Open Package: Network related
PHP Version: 5.6.14 OS: Fedora 22
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-10-29 14:59 UTC] sivann at gmail dot com
connection_status(), connection_aborted () never detect closed remote connection.

After closing connection initiated from client (e.g. wget) connection state becomes CLOSE_WAIT from ESTABLISHED, but those two functions called in a loop never detect that, even when outputing data.

Current solution is to popen netstat, or parse /proc/net/tcp, /proc/net/tcp6 to find if connection is established.

connection_status/connection_aborted should detect the connection loss even without writing anything. Currently those functions do nothing.

Test script:
function fecho($str) {
while (1) {
    sleep (1);
    echo "...\n"; 
    if (connection_status()!= CONNECTION_NORMAL){ //never works
        file_put_contents("conlog.txt","connection closed\n",FILE_APPEND);
        " connection_aborted():".connection_aborted()."\n",FILE_APPEND);

Expected result:
The above writes on a file named conlog.txt. Call the above script with wget. The script should start writing data to conlog.txt at the server. Then press Ctrl+C to stop wget. The script should end. 

Actual result:
The script never stops running.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-29 15:11 UTC] sivann at gmail dot com
httpd-2.4.16 (apache)
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jul 25 22:01:23 2021 UTC