1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix not thread safe xmlSchemaParse calls in ZTS builds

By calling xmlSchemaInitTypes during MINIT.
See: https://gitlab.gnome.org/GNOME/libxml2/-/issues/930

Closes GH-20150.
This commit is contained in:
SpencerMalone
2025-10-12 12:04:24 -07:00
committed by Niels Dossche
parent 88f8c5c0bb
commit f14e5fcfbd
2 changed files with 8 additions and 0 deletions

3
NEWS
View File

@@ -19,6 +19,9 @@ PHP NEWS
. Fixed bug GH-20070 (Return type violation in imagefilter when an invalid
filter is provided). (Girgias)
- LibXML:
. Fix not thread safe xmlSchemaParse calls. (SpencerMalone)
- Opcache:
. Fixed bug GH-20081 (access to uninitialized vars in preload_load()).
(Arnaud)

View File

@@ -39,6 +39,7 @@
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/relaxng.h>
#include <libxml/xmlschemas.h>
#include <libxml/xmlschemastypes.h>
#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();