{
TSRMLS_FETCH();
/* reset libxml generic error handling */
- xmlSetGenericErrorFunc(NULL, NULL);
- xmlSetStructuredErrorFunc(NULL, NULL);
+ if (_php_libxml_per_request_initialization) {
+ xmlSetGenericErrorFunc(NULL, NULL);
+ xmlSetStructuredErrorFunc(NULL, NULL);
- xmlParserInputBufferCreateFilenameDefault(NULL);
- xmlOutputBufferCreateFilenameDefault(NULL);
+ xmlParserInputBufferCreateFilenameDefault(NULL);
+ xmlOutputBufferCreateFilenameDefault(NULL);
+ }
if (LIBXML(stream_context)) {
- zval_ptr_dtor(&LIBXML(stream_context));
+ /* the steam_context resource will be released by resource list destructor */
+ efree(LIBXML(stream_context));
LIBXML(stream_context) = NULL;
}
smart_str_free(&LIBXML(error_buffer));