|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-12 19:01 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 23:00:01 2025 UTC |
Description: ------------ The connection_aborted() doesn't work under CGI. I discovered this bug when I was coding a current download count script. The "ISAPI/Apache Modules" work fine with this function. Reproduce code: --------------- I used the following code to output some text in a slow maner, than I stopped it to see if the file is written. The file is written under the ISAPI/Apache Modules, but it isn't written when using CGI. Why is that? <?php ignore_user_abort(1); // Type a message to animate on the person's browser. $string = "This dummy text will be shown every second untill it's finished. You should<br> close the browser while it's typing on your screen and check message.txt"; $output = str_split($string, 1); for ($n=0; $n < count($output); $n++) { set_time_limit(0); flush(); ob_end_flush(); sleep(1); echo $output[$n]; if (connection_aborted()) { $fp = fopen("message.txt", "w"); fwrite($fp, "Download Aborted! No!!!!!"); fclose($fp); exit; } } ?> Expected result: ---------------- IF the condition of connection_aborted() is TRUE, it should write message.txt with some text in it. Actual result: -------------- Nothing is written!