From c625d917a2f80d50f0690c5c45f0e9f832a7e223 Mon Sep 17 00:00:00 2001 From: SpencerMalone Date: Sun, 12 Oct 2025 12:04:24 -0700 Subject: [PATCH] Fix not thread safe xmlSchemaParse calls in ZTS builds by calling xmlSchemaInitTypes during MINIT. See: https://gitlab.gnome.org/GNOME/libxml2/-/issues/930 --- ext/libxml/libxml.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index eecbca4ed8908..6864b25c87908 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -39,6 +39,7 @@ #ifdef LIBXML_SCHEMAS_ENABLED #include #include +#include #endif #include "php_libxml.h" @@ -933,7 +934,11 @@ PHP_LIBXML_API void php_libxml_initialize(void) if (!_php_libxml_initialized) { /* we should be the only one's to ever init!! */ ZEND_IGNORE_LEAKS_BEGIN(); + xmlInitParser(); +#ifdef LIBXML_SCHEMAS_ENABLED + xmlSchemaInitTypes(); +#endif ZEND_IGNORE_LEAKS_END(); _php_libxml_default_entity_loader = xmlGetExternalEntityLoader();