phptal / PHPTAL

PHP Template Attribute Language — template engine for XSS-proof well-formed XHTML and HTML5 pages
http://phptal.org
GNU Lesser General Public License v2.1
175 stars 43 forks source link

Is this a bug? #95

Open krionix1981 opened 1 month ago

krionix1981 commented 1 month ago

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?

Ocramius commented 1 month ago

that makes the whole engine to fail with some fatal exception in PHPTAL class (sorry did not save it).

Well, that is not valid XML, right?

I'd certainly expect an exception though.