Skip to content

hasTemplate() will result in an error when drawing templates from code #402

@Marian-Kechlibar

Description

@Marian-Kechlibar

Version: 3.0.22

Bug Description

I draw a certain latte file with path = $path in an Ajax request using the following code:

            $templateParams = [Parameters::PARAMETER_ID => $id, 'historyRecord' => $historyRecord, 'data' => $data];
            $renderedHtml = $this->templateFactory->createTemplate($this)->renderToString($path, $templateParams);

The code is located in a handle.... method of a Presenter and processes signals.

This works perfectly as long as I don't use the new method hasTemplate() within that latte. If I do, the following error is encountered:

Typed property Latte\Essential\CoreExtension::$engine must not be accessed before initialization

I am attaching the compiled Latte file. The critical line is 135:

`

templates-Synchronizationnode-syncnode-history-detail.latte--6e140406f1.php

`
This invokes

vendor\latte\latte\src\Latte\Essential\CoreExtension.php:202

where the error happens.

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