diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 64d60481ce..e63d7cf302 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -300,7 +300,11 @@ class Response if (function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); } else { - while (0 < ob_get_level()) { + // ob_get_level() never returns 0 on some Windows configurations, so if + // the level is the same two times in a row, the loop should be stopped. + $previous = null; + while (($level = ob_get_level()) > 0 && $level !== $previous) { + $previous = $level; ob_end_flush(); } flush();