|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10490 xslt_process() generates fatal error
Submitted: 2001-04-25 10:32 UTC Modified: 2001-04-26 09:59 UTC
From: svein-roar dot nilsen at statkart dot no Assigned:
Status: Closed Package: Sablotron XSL
PHP Version: 4.0 Latest CVS (25/04/2001) OS: Debian Unstable
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: svein-roar dot nilsen at statkart dot no
New email:
PHP Version: OS:


 [2001-04-25 10:32 UTC] svein-roar dot nilsen at statkart dot no
Well, not actually the latest CVS, but RC6-2 from Debian Unstable, which should be close enough...

At 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";

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

<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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-26 09:59 UTC]
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).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC