fix nested buffers issue #374

This commit is contained in:
Matthieu Robin
2011-07-01 10:35:24 +02:00
parent 661e9c7ad2
commit 681d2b8b7f
Regular → Executable
+2 -5
View File
@@ -192,15 +192,12 @@ abstract class Twig_Template implements Twig_TemplateInterface
*/ */
public function render(array $context) public function render(array $context)
{ {
$level = ob_get_level();
ob_start(); ob_start();
try { try {
$this->display($context); $this->display($context);
} catch (Exception $e) { } catch (Exception $e) {
// the count variable avoids an infinite loop on while (ob_get_level() > $level) {
// some Windows configurations where ob_get_level()
// never reaches 0
$count = 100;
while (ob_get_level() && --$count) {
ob_end_clean(); ob_end_clean();
} }