From: trustpunk at gmail dot com
Operating system: Windows
PHP version: 5.2.0
PHP Bug Type: CGI related
Bug description: connection_abort() Fails when using the CGI Interface.
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 bug report at http://bugs.php.net/?id=39478&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39478&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39478&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39478&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39478&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39478&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39478&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39478&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39478&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39478&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39478&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39478&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39478&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39478&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39478&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39478&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39478&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39478&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39478&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39478&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39478&r=mysqlcfg