Patch Moves the Registering of the PHP XML Streams to the request init, instead of installing them globaly in the Module init.
This is needed if any other Apache modules use libxml2 on a non-php request. If this patch is not applied, any other use of libxml2 in the same process will likely fail when the PHP callbacks are called. Thanks, -Paul Querna
Index: ext/libxml/libxml.c =================================================================== RCS file: /repository/php-src/ext/libxml/libxml.c,v retrieving revision 1.17 diff -u -r1.17 libxml.c --- ext/libxml/libxml.c 23 Apr 2004 17:31:44 -0000 1.17 +++ ext/libxml/libxml.c 27 May 2004 05:09:51 -0000 @@ -384,22 +384,6 @@ /* we should be the only one's to ever init!! */ xmlInitParser(); - /* Enable php stream/wrapper support for libxml - we only use php streams, so we do not enable - the default io handlers in libxml. - */ - xmlRegisterInputCallbacks( - php_libxml_streams_IO_match_wrapper, - php_libxml_streams_IO_open_read_wrapper, - php_libxml_streams_IO_read, - php_libxml_streams_IO_close); - - xmlRegisterOutputCallbacks( - php_libxml_streams_IO_match_wrapper, - php_libxml_streams_IO_open_write_wrapper, - php_libxml_streams_IO_write, - php_libxml_streams_IO_close); - zend_hash_init(&php_libxml_exports, 0, NULL, NULL, 1); _php_libxml_initialized = 1; @@ -434,6 +418,22 @@ /* report errors via handler rather than stderr */ xmlSetGenericErrorFunc(NULL, php_libxml_error_handler); + /* Enable php stream/wrapper support for libxml + we only use php streams, so we do not enable + the default io handlers in libxml. + */ + xmlRegisterInputCallbacks( + php_libxml_streams_IO_match_wrapper, + php_libxml_streams_IO_open_read_wrapper, + php_libxml_streams_IO_read, + php_libxml_streams_IO_close); + + xmlRegisterOutputCallbacks( + php_libxml_streams_IO_match_wrapper, + php_libxml_streams_IO_open_write_wrapper, + php_libxml_streams_IO_write, + php_libxml_streams_IO_close); + return SUCCESS; } @@ -451,6 +451,10 @@ /* reset libxml generic error handling */ xmlSetGenericErrorFunc(NULL, NULL); + /* Reset The Default libxml Callbacks */ + xmlRegisterDefaultInputCallbacks(); + xmlRegisterDefaultOutputCallbacks(); + smart_str_free(&LIBXML(error_buffer)); return SUCCESS; }
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php