Commit: 503358c1797e0f7b05fb49f22dd44bc7f517069f Author: Gustavo André dos Santos Lopes <cataphr...@php.net> Sat, 9 Jun 2012 17:29:47 +0100 Parents: c4cc43169c0ae05127eb406fcfd837597b72b71e Branches: PHP-5.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=503358c1797e0f7b05fb49f22dd44bc7f517069f Log: Fix bug #62266 Custom extension segfaults during xmlParseFile with FPM SAPI because the regular list is not prepared during the MINIT phase and our custom external entity loader tries to open PHP streams. Bugs: https://bugs.php.net/62266 Changed paths: M NEWS M ext/libxml/libxml.c Diff: diff --git a/NEWS b/NEWS index 17d1c58..b91b5d7 100644 --- a/NEWS +++ b/NEWS @@ -14,7 +14,7 @@ PHP NEWS . Fixed information leak in ext exif (discovered by Martin Noga, Matthew "j00ru" Jurczyk, Gynvael Coldwind) -- FPM +- FPM: . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) . Fixed bug #62153 (when using unix sockets, multiples FPM instances @@ -33,7 +33,7 @@ PHP NEWS - Iconv: . Fix bug #55042 (Erealloc in iconv.c unsafe). (Stas) -- Intl +- Intl: . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) . ResourceBundle constructor now accepts NULL for the first two arguments. (Gustavo) @@ -43,6 +43,10 @@ PHP NEWS . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks pattern). (Gustavo) +- libxml: + . Fixed bug #62266 (Custom extension segfaults during xmlParseFile with FPM + SAPI). (Gustavo) + - Readline: . Fixed bug #62186 (readline fails to compile - void function should not return a value). (Johannes) diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index e42d845..a39c875 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -677,9 +677,18 @@ is_string: static xmlParserInputPtr _php_libxml_pre_ext_ent_loader(const char *URL, const char *ID, xmlParserCtxtPtr context) { + TSRMLS_FETCH(); + /* Check whether we're running in a PHP context, since the entity loader - * we've defined is an application level (true global) setting */ - if (xmlGenericError == php_libxml_error_handler) { + * we've defined is an application level (true global) setting. + * If we are, we also want to check whether we've finished activating + * the modules (RINIT phase). Using our external entity loader during a + * RINIT should not be problem per se (though during MINIT it is, because + * we don't even have a resource list by then), but then whether one + * extension would be using the custom external entity loader or not + * could depend on extension loading order + * (if _php_libxml_per_request_initialization */ + if (xmlGenericError == php_libxml_error_handler && PG(modules_activated)) { return _php_libxml_external_entity_loader(URL, ID, context); } else { return _php_libxml_default_entity_loader(URL, ID, context); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php