Bug #10490 Updated: xslt_process() generates fatal error
| From: | sterling@php.net | Date: | Thu, 26 Apr 2001 13:59:33 +0000 |
| Subject: | Bug #10490 Updated: xslt_process() generates fatal error | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52490@lists.php.net to get a copy of this message | ||
ID: 10490
Updated by: sterling
Reported By: svein-roar.nilsen@statkart.no
Old-Status: Open
Status: Closed
Bug Type: Sablotron XSL
PHP Version: 4.0 Latest CVS (25/04/2001)
Assigned To:
Comments:
If you really want to catch the error you can use the
xslt_set_error_handler() function. Not a bug (already had
this conversation with a user, check the closed bug reports
to view it).
Previous Comments:
---------------------------------------------------------------------------
[2001-04-25 10:32:18] svein-roar.nilsen@statkart.no
Well, not actually the latest CVS, but RC6-2 from Debian Unstable, which should be close enough...
At http://www.php.net/manual/en/function.xslt-process.php
there is an example program. When I use it as is, it works all right and produces a nice table. Here
is a short section of the code:
-----
[...]
if (xslt_process($xslData, $xmlData, $result)) {
[...]
} else {
echo "There was an error that occurred in the XSL transformation...n";
echo "tError number: " . xslt_errno() . "n";
echo "tError string: " . xslt_error() . "n";
exit;
}
?>
-----
This is quite similar to what I am trying. If you now corrupts the xmlData variable, e.g. by
changing <article> to <rticl> without changing the closing tag, you will get an error
message saying
<br>
<b>Fatal error</b>: XML parser error 7: mismatched tag in
<b>/var/www/test.php</b> on line <b>40</b><br>
As you can see here, xslt_process() dies with a fatal error and the program is terminated, and we
never get to testing the return value. The next problem, is that since the error is
"fatal", it is also not possible to use set_error_handler() to catch the error.
Of course it can be discussed wether this is a bug or not, but when a function is documented to
return false on error, I would not expect it to lay down and die. And since it should not corrupt
the PHP internals in any way, I would at least expect to be able to handle it with
set_error_handler().
Svein Roar Nilsen
Norwegian Hydrographic Services
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10490&edit=2