mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
merged branch real-chocopanda/ob_fix (PR #379)
Commits -------75748a5revert accidental mode change681d2b8fix nested buffers issue #374 Discussion ---------- fix nested buffers issue #374 see #374 for details --------------------------------------------------------------------------- by fabpot at 2011/07/09 01:02:50 -0700 You have inadvertently changed the mode to 0755. Should stay at 0644. --------------------------------------------------------------------------- by macolu at 2011/07/09 03:07:42 -0700 Mode change reverted. About this Windows bug... Are you talking about the zlib issue? When zlib compression is activated, it adds a buffer level that ob_end_clean() can't close. So ob_get_level() never go below 1. http://cksource.com/forums/viewtopic.php?t=21653 http://www.php.net/manual/fr/function.ob-get-level.php#52945 In that case, the first ob_get_level() call will always return something greater than 0. So $level var will be > 0. This should avoid infinite loops.
This commit is contained in:
@@ -192,15 +192,12 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
*/
|
||||
public function render(array $context)
|
||||
{
|
||||
$level = ob_get_level();
|
||||
ob_start();
|
||||
try {
|
||||
$this->display($context);
|
||||
} catch (Exception $e) {
|
||||
// the count variable avoids an infinite loop on
|
||||
// some Windows configurations where ob_get_level()
|
||||
// never reaches 0
|
||||
$count = 100;
|
||||
while (ob_get_level() && --$count) {
|
||||
while (ob_get_level() > $level) {
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user