Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10104 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87484 invoked by uid 1010); 27 May 2004 05:13:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 87399 invoked from network); 27 May 2004 05:13:54 -0000 Received: from unknown (HELO utopia.in.force-elite.com) (216.255.199.145) by pb1.pair.com with SMTP; 27 May 2004 05:13:54 -0000 X-AuthUser: chip@force-elite.com Received: from [10.0.0.22] (10.0.0.22:33455) by utopia.in.force-elite.com with [XMail 1.17 (Linux/Ix86) ESMTP Server] id for from ; Thu, 27 May 2004 05:13:53 -0000 To: internals@lists.php.net Content-Type: multipart/mixed; boundary="=-7YqPk3ORqPi3mNnVoShp" Message-ID: <1085634832.3168.40.camel@localhost> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.5.7 Date: Wed, 26 May 2004 22:13:52 -0700 Subject: [PATCH] libxml - Move Callback Reg to Request Init From: chip@force-elite.com (Paul Querna) --=-7YqPk3ORqPi3mNnVoShp Content-Type: text/plain Content-Transfer-Encoding: 7bit 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 --=-7YqPk3ORqPi3mNnVoShp Content-Disposition: attachment; filename=php5-xml-register-callbacks.patch Content-Type: text/x-patch; name=php5-xml-register-callbacks.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit 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; } --=-7YqPk3ORqPi3mNnVoShp--