From: nathanb
Operating system: N/A
PHP version: 5.4.11
Package: Output Control
Bug Type: Bug
Bug description:Output Buffering does not work with Connection Handling
Description:
------------
While an output buffer is in place the functions connection_aborted() and
connection_status() will not return proper information. (I have only tested
in
apache2)
INSTRUCTIONS ON TEST SCRIPT:
In a terminal run "tail -f /tmp/test.tmp" put script in www accessible
directory,
run the script from a browser and within a second or two stop the
connection or
close browser. Watch the terminal for actions to take place. (comment out
the
ob_start() function to see how it should react)
Test script:
---------------
<?php
ignore_user_abort(true);
ob_flush();
flush();
// Comment this out to see it work properly
ob_start(function ($data, $mode){
return $data;
}, 1);
$i=0;
for($i=0;$i++<200;){
echo "----";
ob_flush();
flush();
if(connection_aborted()){
file_put_contents('/tmp/test.tmp', sprintf("Conn Closed\nLoop
itterations: %s\n\n", $i), FILE_APPEND);
exit;
}
usleep(50000);
}
file_put_contents('/tmp/test.tmp', "Timeout\n\n", FILE_APPEND);
?>
Expected result:
----------------
Conn Closed
Loop itterations: %i
Actual result:
--------------
Timeout
--
Edit bug report at https://bugs.php.net/bug.php?id=64240&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=64240&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=64240&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=64240&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64240&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64240&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64240&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64240&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64240&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64240&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64240&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=64240&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=64240&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64240&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64240&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64240&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64240&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64240&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64240&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64240&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64240&r=mysqlcfg