Should flush() send headers when output buffering is enabled?
#1659
-
|
I encountered a situation where the Example: headers_sent(); // => false
ob_start();
ob_start();
ob_get_level(); // => 2
headers_sent(); // => false
flush();
ob_get_level(); // => 2
headers_sent(); // => true
// ...Headers were not sent before version 1.7.0, they started to be sent with version 1.7.0. I will trace this behavior back to #1622. Is this correct behavior for the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
It's a good question. I'm more curious why PHP is telling the SAPI to flush at that point, if it is still output buffering. So, I'm inclined to say it is working properly, since PHP told us to flush our buffers, but more investigation might be needed. |
Beta Was this translation helpful? Give feedback.
-
|
After testing the following on nginx + fpm and on frankenphp; the behaviour is indeed correct: headers_sent();
ob_start();
ob_start();
var_dump(headers_sent()); // false
flush();
header("Content-Type: text/plain"); // notice: headers already sent
var_dump(headers_sent()); // true |
Beta Was this translation helpful? Give feedback.
After testing the following on nginx + fpm and on frankenphp; the behaviour is indeed correct: