ID: 39478 Updated by: [EMAIL PROTECTED] Reported By: trustpunk at gmail dot com -Status: Open +Status: Bogus Bug Type: CGI related Operating System: Windows PHP Version: 5.2.0 New Comment:
This happens because CGI is not a part of the web-server, so there is CGI executeble is executed first and then you got it's output through the web-server. There is no chance to detect if connection has been aborted when running in CGI mode. Previous Comments: ------------------------------------------------------------------------ [2006-11-12 11:53:49] trustpunk at gmail dot com 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! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39478&edit=1