@@ -1074,7 +1074,7 @@ PHP_METHOD(DOMDocument, getElementById)
1074
1074
}
1075
1075
/* }}} end dom_document_get_element_by_id */
1076
1076
1077
- static zend_always_inline void php_dom_transfer_document_ref_single_node (xmlNodePtr node , php_libxml_ref_obj * new_document )
1077
+ static void php_dom_transfer_document_ref_single_node (xmlNodePtr node , php_libxml_ref_obj * new_document )
1078
1078
{
1079
1079
php_libxml_node_ptr * iteration_object_ptr = node -> _private ;
1080
1080
if (iteration_object_ptr ) {
@@ -1087,21 +1087,25 @@ static zend_always_inline void php_dom_transfer_document_ref_single_node(xmlNode
1087
1087
}
1088
1088
}
1089
1089
1090
- static void php_dom_transfer_document_ref (xmlNodePtr node , php_libxml_ref_obj * new_document )
1090
+ static void php_dom_transfer_document_ref_single_aux (xmlNodePtr node , php_libxml_ref_obj * new_document )
1091
1091
{
1092
- if (node -> children ) {
1093
- php_dom_transfer_document_ref (node -> children , new_document );
1092
+ php_dom_transfer_document_ref_single_node (node , new_document );
1093
+ if (node -> type == XML_ELEMENT_NODE ) {
1094
+ for (xmlAttrPtr attr = node -> properties ; attr != NULL ; attr = attr -> next ) {
1095
+ php_dom_transfer_document_ref_single_node ((xmlNodePtr ) attr , new_document );
1096
+ }
1094
1097
}
1098
+ }
1095
1099
1096
- while (node ) {
1097
- if (node -> type == XML_ELEMENT_NODE ) {
1098
- for (xmlAttrPtr attr = node -> properties ; attr != NULL ; attr = attr -> next ) {
1099
- php_dom_transfer_document_ref_single_node ((xmlNodePtr ) attr , new_document );
1100
- }
1101
- }
1100
+ static void php_dom_transfer_document_ref (xmlNodePtr node , php_libxml_ref_obj * new_document )
1101
+ {
1102
+ xmlNodePtr base = node ;
1103
+ php_dom_transfer_document_ref_single_aux (base , new_document );
1102
1104
1103
- php_dom_transfer_document_ref_single_node (node , new_document );
1104
- node = node -> next ;
1105
+ node = node -> children ;
1106
+ while (node != NULL ) {
1107
+ php_dom_transfer_document_ref_single_aux (node , new_document );
1108
+ node = php_dom_next_in_tree_order (node , base );
1105
1109
}
1106
1110
}
1107
1111
0 commit comments