Skip to content

Variables from the rendering process leak into templates #301

@Rayne

Description

@Rayne

When rendering templates, variables from the rendering process leak into the template. This can be checked via

<?= $this->e(var_export(get_defined_vars(), true)) ?>

The results looks like this when no custom variables are specified:

array (
  'path' => '/…/example.php',
  'level' => 1,
)

This issue can be prevented by storing these values in the object that is rendering templates.

$path = ($this->engine->getResolveTemplatePath())($this->name);
try {
$level = ob_get_level();
ob_start();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions