Daniel Jakob
2012-05-01 08:36:48 UTC
Hi list
After upgrading TAL to 1.2.2, I found a little problem which makes TAL
quite unuseable in scenarios, when you are not able to control the given
xhtml source. Maybe, the problem depends on newer php versions and/or
eaccelerator.
SaxXmlParser::parseString() throws a PHPTAL_ParserException which isn't
catched by the try/catch block which leads directly to an apache
segfault.
The only exception which gets catched is the PHPTAL_TemplateException.
The ParserException subclasses the TemplateException but - however - php
doesn't care about it. This happens every time when I access the script
BUT not the first time. Setting forceReparse to true also 'fixes' the
problem so I assume, the problem is somewhere between the phptal cache
files and the exceptions in php. Maybe, the eaccelerator is involved,
too.
What definitely helps is to explicitly catch PHPTAL_ParserException at
the end of the switch-block (like the TemplateException does).
A sample:
test.xhtml:
<html>
<body>
<span style="" style="">I kill the parser</span>
</body>
</html>
test.php:
require_once('phptal/PHPTAL.php');
$template = new PHPTAL('test.xhtml');
$template->setOutputMode(PHPTAL::XML);
$template->execute();
Expected result:
PHPTAL Exception
Attribute style in < span > is defined more than once
Actual result:
Apache segmentation fault
Used environments:
1. Gentoo amd64, apache 2.22, php 5.3.11, eaccelerator 0.9.6.1
2. Gentoo amd64, apache 2.22, php 5.3.9, eaccelerator 0.9.6.1
3. Ubuntu x86, apache 2.22, php 5.3.6, eaccelerator 0.9.6.1
Maybe, someone has a clue. At least, this report may help anyone having
the same problem :)
cu
Daniel
After upgrading TAL to 1.2.2, I found a little problem which makes TAL
quite unuseable in scenarios, when you are not able to control the given
xhtml source. Maybe, the problem depends on newer php versions and/or
eaccelerator.
SaxXmlParser::parseString() throws a PHPTAL_ParserException which isn't
catched by the try/catch block which leads directly to an apache
segfault.
The only exception which gets catched is the PHPTAL_TemplateException.
The ParserException subclasses the TemplateException but - however - php
doesn't care about it. This happens every time when I access the script
BUT not the first time. Setting forceReparse to true also 'fixes' the
problem so I assume, the problem is somewhere between the phptal cache
files and the exceptions in php. Maybe, the eaccelerator is involved,
too.
What definitely helps is to explicitly catch PHPTAL_ParserException at
the end of the switch-block (like the TemplateException does).
A sample:
test.xhtml:
<html>
<body>
<span style="" style="">I kill the parser</span>
</body>
</html>
test.php:
require_once('phptal/PHPTAL.php');
$template = new PHPTAL('test.xhtml');
$template->setOutputMode(PHPTAL::XML);
$template->execute();
Expected result:
PHPTAL Exception
Attribute style in < span > is defined more than once
Actual result:
Apache segmentation fault
Used environments:
1. Gentoo amd64, apache 2.22, php 5.3.11, eaccelerator 0.9.6.1
2. Gentoo amd64, apache 2.22, php 5.3.9, eaccelerator 0.9.6.1
3. Ubuntu x86, apache 2.22, php 5.3.6, eaccelerator 0.9.6.1
Maybe, someone has a clue. At least, this report may help anyone having
the same problem :)
cu
Daniel