Skip to content

PHPTAL errors out when given a empty string (or only an empty comment) to parse #95

@krionix1981

Description

@krionix1981

Hi

Nasty code I wrote ages ago is

$template = new myPHPTAL('index.html');
...
try {
  $layout -> set('content', $template->execute() );
  echo $layout->execute();
)
catch {
 smth like mail to me
}

What I found is that if I have index.html like below (yes just a HTML comment, nothing else!)
<!-- -->
that makes the whole engine to fail with some fatal exception in PHPTAL class (sorry did not save it).

The whole catch block with PHP 82 and latest PHPTAL will not execute, will crash (not even triggering catch block but maybe it is poorly written - my bad). Replacing a comment with <span></span> would make my site working again!

It used to work with PHP 5.6 and 1.3.1 PHPTAL but just upgrading to latest + PHP 8.2 made the site crash due to this "template made of a comment".

Should not behave like that?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions