merged branch iteman/support_for_php_new_output_api (PR #8692)

This PR was merged into the master branch.

Discussion
----------

[HttpFoundation] add missing support for the new output API in PHP 5.4...

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

As of PHP 5.4, the new output API has been introduced:

* https://github.com/php/php-src/blob/master/README.NEW-OUTPUT-API
* 11d24c1593
* https://bugs.php.net/bug.php?id=64977

Commits
-------

188c0ce [HttpFoundation] added missing support for the new output API in PHP 5.4+
This commit is contained in:
Fabien Potencier 2013-08-08 13:53:27 +02:00
commit 227e1dd7cb

View File

@ -321,8 +321,16 @@ class Response
$obStatus = ob_get_status(1);
while (($level = ob_get_level()) > 0 && $level !== $previous) {
$previous = $level;
if ($obStatus[$level - 1] && isset($obStatus[$level - 1]['del']) && $obStatus[$level - 1]['del']) {
ob_end_flush();
if ($obStatus[$level - 1]) {
if (version_compare(PHP_VERSION, '5.4', '>=')) {
if (isset($obStatus[$level - 1]['flags']) && ($obStatus[$level - 1]['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE)) {
ob_end_flush();
}
} else {
if (isset($obStatus[$level - 1]['del']) && $obStatus[$level - 1]['del']) {
ob_end_flush();
}
}
}
}
flush();