ID: 10490
Updated by: sterling
Old-Status: Open
Status: Closed
Bug Type: Sablotron XSL
PHP Version: 4.0 Latest CVS (25/04/2001)
Assigned To: 

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] [EMAIL PROTECTED]
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


ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to