nette / latte

☕ Latte: the safest & truly intuitive templates for PHP. Engine for those who want the most secure PHP sites.
https://latte.nette.org
Other
1.13k stars 109 forks source link

Notice: Undefined property: stdClass::$ifcontent #271

Closed michalhlavka closed 2 years ago

michalhlavka commented 3 years ago

Version: v2.4.9

Notice: Undefined property: stdClass::$ifcontent in /var/www...

Latte code

<div n:ifcontent n:if="false"></div>

Generated code

<?php
        ob_start(function () {});
        if (false) {
            ?>  <div><?php
            ob_start();
            $this->global->ifcontent = ob_get_flush();
?></div>
<?php
        }
        if (rtrim($this->global->ifcontent) === "") ob_end_clean();
        else echo ob_get_clean();
?>

Screenshot 2021-07-07 at 10 46 38

https://fiddle.nette.org/latte/#58bb87ac17

dg commented 2 years ago

Fixed in 2.10-dev