#17774 [Opn->Csd]: connection_status() not returning correct result

From: Date: Mon, 30 Sep 2002 03:47:09 +0000
Subject: #17774 [Opn->Csd]: connection_status() not returning correct result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-20744@lists.php.net to get a copy of this message
ID: 17774 Updated by: iliaa@php.net Reported By: neil@mpfreescene.com -Status: Open +Status: Closed Bug Type: Scripting Engine problem Operating System: FREEBSD 4.5-STABLE PHP Version: 4.0CVS-2002-06-15 New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Using latest CVS snapshot I cannot replicate the problem you've described. According to http://www.php.net/manual/en/features.connection-handling.php 0 - NORMAL, and 0 is what gets printed to the browser. Upon untimely termination of script, 1 is written to the output file, which means that connection was aborted. Previous Comments: ------------------------------------------------------------------------ [2002-09-25 12:40:54] neil.doody@talk21.com An ammendmant to my last two posts. I would expect the script to put a '1' into wank.txt if somebody presses the STOP button on there browser. However the output I am getting is a '0' to say it disconnected regulary. ------------------------------------------------------------------------ [2002-09-25 08:33:25] neil.doody@talk21.com Oh yeah, running that script, if I press the STOP button halfway through, after a while it will output "0" into wank.txt, which is wrong, it should put 2 is it? for connection closed. ------------------------------------------------------------------------ [2002-09-25 08:31:31] neil.doody@talk21.com I found there may be flaws with that code, so I wrote something else to test if the function was fixed, and it appears not, here is the code, if somebody cancels I would expect it to put '0' into wank.txt :- <? function exitfp() { $fp = fopen("wank.txt","w"); fputs($fp, connection_status()); fclose($fp); } register_shutdown_function('exitfp'); if(connection_aborted() != true){print "0";} flush(); ignore_user_abort(true); $m = '50'; while(connection_aborted() != true and $m > $a){ sleep('1'); print connection_status(); flush(); $a = $a + 1; } exitfp(); ?> ------------------------------------------------------------------------ [2002-09-25 07:38:18] neil.doody@talk21.com According to Bug #17265 this problem should be fixed rite? Well I downloaded the latest CVS like 5 minutes ago. THe following code snippets should return into a file that the connection was aborted, if this function was really fixed, rite?? well the outputs I am getting into my temp files to check the output of the script is "6077440 - 6076648 - 0 - not aborted - Keep-Alive" Heres the script :- while(!feof($pl_of) and !connection_aborted()) { $pl_buffer = fread($pl_of, 1024); echo($pl_buffer); flush(); $pl_sent = $pl_sent + 1024; } fclose ($pl_of); if ($pl_sent >= $pl_filesize){ $pl_totalsent = "100%"; }else{ $pl_totalsent = round((100 / $pl_filesize * $pl_sent),2) . "%"; } if (connection_aborted() == true){ $temp = 'aborted'; }else{ $temp = 'not aborted'; } $pl_totalsent = "$pl_sent - $pl_filesize - " . connection_status() . " - " . $temp . " - " . $_SERVER['HTTP_CONNECTION']; ------------------------------------------------------------------------ [2002-07-07 13:10:32] david@hexstream.f9.co.uk Has this bug been looked in to at all? Under FreeBSD, connection_status /always/ returns 0. I've never tried it with any other flavours of BSD. Regards, David. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/17774 -- Edit this bug report at http://bugs.php.net/?id=17774&edit=1

« previous php.bugs (#20744) next »