Skip to content

Commit 19fc6ed

Browse files
authored
soap: Switch to new XML parser option setting API (#20020)
This API does not require the "global" security workaround. We also pass some additional options for hardening.
1 parent a3f0861 commit 19fc6ed

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/soap/php_xml.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ static xmlDocPtr soap_xmlParse_ex(xmlParserCtxtPtr ctxt)
7979
{
8080
xmlDocPtr ret;
8181
if (ctxt) {
82+
#if LIBXML_VERSION >= 21300
83+
xmlCtxtSetOptions(ctxt, XML_PARSE_HUGE | XML_PARSE_NO_XXE | XML_PARSE_NONET | XML_PARSE_NOBLANKS);
84+
#else
8285
php_libxml_sanitize_parse_ctxt_options(ctxt);
83-
/* TODO: In libxml2 2.14.0 change this to the new options API so we don't rely on deprecated APIs. */
8486
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
8587
ctxt->keepBlanks = 0;
8688
ctxt->options |= XML_PARSE_HUGE;
8789
ZEND_DIAGNOSTIC_IGNORED_END
90+
#endif
8891
ctxt->sax->ignorableWhitespace = soap_ignorableWhitespace;
8992
ctxt->sax->comment = soap_Comment;
9093
ctxt->sax->warning = NULL;

0 commit comments

Comments
 (0)