diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index c44fec3ab0d28..e0cf63dd1daaa 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -3381,6 +3381,7 @@ xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns) } else { smart_str prefix = {0}; int num = ++SOAP_GLOBAL(cur_uniq_ns); + xmlChar *enc_ns; while (1) { smart_str_appendl(&prefix, "ns", 2); @@ -3394,7 +3395,9 @@ xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns) num = ++SOAP_GLOBAL(cur_uniq_ns); } - xmlns = xmlNewNs(node->doc->children, BAD_CAST(ns), BAD_CAST(prefix.s ? ZSTR_VAL(prefix.s) : "")); + enc_ns = xmlEncodeSpecialChars(node->doc, BAD_CAST(ns)); + xmlns = xmlNewNs(node->doc->children, enc_ns, BAD_CAST(prefix.s ? ZSTR_VAL(prefix.s) : "")); + xmlFree(enc_ns); smart_str_free(&prefix); } } diff --git a/ext/soap/tests/bug69668.phpt b/ext/soap/tests/bug69668.phpt new file mode 100644 index 0000000000000..59b3aa648fc8f --- /dev/null +++ b/ext/soap/tests/bug69668.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #69668 (SOAP: special XML characters in namespace URIs not encoded) +--SKIPIF-- + +--FILE-- + true, + 'exceptions' => true, + 'cache_wsdl' => WSDL_CACHE_NONE, +]); + +$client->test(); +?> +--EXPECT-- + + diff --git a/ext/soap/tests/bug69668.wsdl b/ext/soap/tests/bug69668.wsdl new file mode 100644 index 0000000000000..675db1e3e4b1d --- /dev/null +++ b/ext/soap/tests/bug69668.wsdl @@ -0,0 +1,35 @@ + + + + + + + + test + + + + + + + + + + + + + + + + + + + + + + + + + +