php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64240 Output Buffering does not work with Connection Handling
Submitted: 2013-02-18 21:08 UTC Modified: 2013-07-30 19:20 UTC
From: nathanb@php.net Assigned: mike (profile)
Status: Not a bug Package: Output Control
PHP Version: 5.4.11 OS: N/A
Private report: No CVE-ID: None
 [2013-02-18 21:08 UTC] nathanb@php.net
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



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-30 19:20 UTC] mike@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: mike
 [2013-07-30 19:20 UTC] mike@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 22:01:28 2024 UTC