xmlSetGenericErrorFunc Abuse
| From: | Paul Querna | Date: | Wed, 21 Apr 2004 21:36:40 +0000 |
| Subject: | xmlSetGenericErrorFunc Abuse | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-9471@lists.php.net to get a copy of this message | ||
The libxml2 Extension in PHP5 uses
xmlSetGenericErrorFunc(NULL, php_libxml_error_handler);
This globally(inside the process) sets the libxml2 error hander to PHP's
own function.
Why is this bad?
It clobbers the processing done by anything else that uses libxml2 in
the same process as PHP.
For a simple example, I use mod_transform (
http://svn.outoforder.cc/svn/mod_transform
) with Apache 2 as a filter
to process XML documents w/ XSLT into HTML. If there are _any_ errors
in the transformation PHP attempts to take care of them. This causes
Apache to crash because this is not even a PHP request and very quickly
the Error Handler will crash when it tries to get a server context.
This is not an issue isolated to Apache 2. It could happen in Apache
1.3 if any other module used libxml2.
The proper way for PHP to handle this is to not set a Generic Error
function, but rather check the return values of libxml2 functions.
This is not like the local-mysql vs system-mysql problem that used to be
more common. PHP is initializing libxml2 as if it was the only user,
which is not always the case.
I believe this is something that should be fixed before 5.0 is released.
Thanks,
Paul Querna
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc