@@ -2181,15 +2181,6 @@ static void dom_relink_ns_decls_element(HashTable *links, xmlNodePtr node)
21812181 }
21822182 }
21832183
2184- if (node -> ns ) {
2185- dom_add_synthetic_ns_decl (links , node , node -> ns );
2186- }
2187- for (xmlAttrPtr attr = node -> properties ; attr ; attr = attr -> next ) {
2188- if (attr -> ns && !php_dom_ns_is_fast ((const xmlNode * ) attr , php_dom_ns_is_xmlns_magic_token )) {
2189- dom_add_synthetic_ns_decl_for_attr (links , node , attr -> ns );
2190- }
2191- }
2192-
21932184 /* The default namespace is handled separately from the other namespaces in C14N.
21942185 * The default namespace is explicitly looked up while the other namespaces are
21952186 * deduplicated and compared to a list of visible namespaces. */
@@ -2198,6 +2189,14 @@ static void dom_relink_ns_decls_element(HashTable *links, xmlNodePtr node)
21982189 * can return the current namespace. */
21992190 zend_hash_index_add_new_ptr (links , (zend_ulong ) node | 1 , node -> ns );
22002191 node -> ns = xmlSearchNs (node -> doc , node , NULL );
2192+ } else if (node -> ns ) {
2193+ dom_add_synthetic_ns_decl (links , node , node -> ns );
2194+ }
2195+
2196+ for (xmlAttrPtr attr = node -> properties ; attr ; attr = attr -> next ) {
2197+ if (attr -> ns && !php_dom_ns_is_fast ((const xmlNode * ) attr , php_dom_ns_is_xmlns_magic_token )) {
2198+ dom_add_synthetic_ns_decl_for_attr (links , node , attr -> ns );
2199+ }
22012200 }
22022201 }
22032202}
0 commit comments