File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ PHP NEWS
99 . Fixed bugs GH-20875, GH-20873, GH-20854 (Propagate IN_GET guard in
1010 get_property_ptr_ptr for lazy proxies). (iliaal)
1111
12+ - DOM:
13+ . Fixed bug GH-21486 (Dom\HTMLDocument parser mangles xml:space and
14+ xml:lang attributes). (ndossche)
15+
1216- GD:
1317 . Fixed bug GH-21431 (phpinfo() to display libJPEG 10.0 support).
1418 (David Carlier)
Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ static lexbor_libxml2_bridge_status lexbor_libxml2_bridge_convert(
117117 php_dom_libxml_ns_mapper * ns_mapper = php_dom_ns_mapper_from_private (private_data );
118118 xmlNsPtr html_ns = php_dom_libxml_ns_mapper_ensure_html_ns (ns_mapper );
119119 xmlNsPtr xlink_ns = NULL ;
120+ xmlNsPtr xml_ns = NULL ;
120121 xmlNsPtr prefixed_xmlns_ns = NULL ;
121122
122123 lexbor_array_obj_t work_list ;
@@ -256,6 +257,12 @@ static lexbor_libxml2_bridge_status lexbor_libxml2_bridge_convert(
256257 xlink_ns -> _private = (void * ) php_dom_ns_is_xlink_magic_token ;
257258 }
258259 lxml_attr -> ns = xlink_ns ;
260+ } else if (attr -> node .ns == LXB_NS_XML ) {
261+ if (xml_ns == NULL ) {
262+ xml_ns = php_dom_libxml_ns_mapper_get_ns_raw_strings_nullsafe (ns_mapper , "xml" , DOM_XML_NS_URI );
263+ xml_ns -> _private = (void * ) php_dom_ns_is_xml_magic_token ;
264+ }
265+ lxml_attr -> ns = xml_ns ;
259266 }
260267
261268 if (last_added_attr == NULL ) {
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-21486 (Dom\HTMLDocument parser mangles xml:space and xml:lang attributes)
3+ --EXTENSIONS--
4+ dom
5+ --CREDITS--
6+ JKingweb
7+ --FILE--
8+ <?php
9+ $ d = @\Dom \HTMLDocument::createFromString ("<div></div> " );
10+ $ e = $ d ->getElementsByTagName ("div " )[0 ];
11+ $ e ->innerHTML = '<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace"></svg> ' ;
12+ $ svg = $ d ->querySelector ("svg " );
13+ echo $ e ->innerHTML ."\n" ;
14+ echo $ svg ->attributes [0 ]->localName ." " .var_export ($ svg ->attributes [0 ]->namespaceURI , true )."\n" ;
15+ ?>
16+ --EXPECT--
17+ <svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace"></svg>
18+ space 'http://www.w3.org/XML/1998/namespace'
You can’t perform that action at this time.
0 commit comments