@@ -128,12 +128,8 @@ static bool dom_is_node_in_list(const zval *nodes, uint32_t nodesc, const xmlNod
128
128
{
129
129
for (uint32_t i = 0 ; i < nodesc ; i ++ ) {
130
130
if (Z_TYPE (nodes [i ]) == IS_OBJECT ) {
131
- const zend_class_entry * ce = Z_OBJCE (nodes [i ]);
132
-
133
- if (instanceof_function (ce , dom_node_class_entry )) {
134
- if (dom_object_get_node (Z_DOMOBJ_P (nodes + i )) == node_to_find ) {
135
- return true;
136
- }
131
+ if (dom_object_get_node (Z_DOMOBJ_P (nodes + i )) == node_to_find ) {
132
+ return true;
137
133
}
138
134
}
139
135
}
@@ -398,6 +394,10 @@ void dom_parent_node_after(dom_object *context, zval *nodes, uint32_t nodesc)
398
394
return ;
399
395
}
400
396
397
+ if (UNEXPECTED (dom_sanity_check_node_list_for_insertion (context -> document , parentNode , nodes , nodesc ) != SUCCESS )) {
398
+ return ;
399
+ }
400
+
401
401
/* Spec step 3: find first following child not in nodes; otherwise null */
402
402
xmlNodePtr viable_next_sibling = prevsib -> next ;
403
403
while (viable_next_sibling ) {
@@ -409,10 +409,6 @@ void dom_parent_node_after(dom_object *context, zval *nodes, uint32_t nodesc)
409
409
410
410
doc = prevsib -> doc ;
411
411
412
- if (UNEXPECTED (dom_sanity_check_node_list_for_insertion (context -> document , parentNode , nodes , nodesc ) != SUCCESS )) {
413
- return ;
414
- }
415
-
416
412
php_libxml_invalidate_node_list_cache_from_doc (doc );
417
413
418
414
/* Spec step 4: convert nodes into fragment */
@@ -455,6 +451,10 @@ void dom_parent_node_before(dom_object *context, zval *nodes, uint32_t nodesc)
455
451
return ;
456
452
}
457
453
454
+ if (UNEXPECTED (dom_sanity_check_node_list_for_insertion (context -> document , parentNode , nodes , nodesc ) != SUCCESS )) {
455
+ return ;
456
+ }
457
+
458
458
/* Spec step 3: find first following child not in nodes; otherwise null */
459
459
xmlNodePtr viable_previous_sibling = nextsib -> prev ;
460
460
while (viable_previous_sibling ) {
@@ -466,10 +466,6 @@ void dom_parent_node_before(dom_object *context, zval *nodes, uint32_t nodesc)
466
466
467
467
doc = nextsib -> doc ;
468
468
469
- if (UNEXPECTED (dom_sanity_check_node_list_for_insertion (context -> document , parentNode , nodes , nodesc ) != SUCCESS )) {
470
- return ;
471
- }
472
-
473
469
php_libxml_invalidate_node_list_cache_from_doc (doc );
474
470
475
471
/* Spec step 4: convert nodes into fragment */
@@ -562,6 +558,10 @@ void dom_child_replace_with(dom_object *context, zval *nodes, uint32_t nodesc)
562
558
return ;
563
559
}
564
560
561
+ if (UNEXPECTED (dom_sanity_check_node_list_for_insertion (context -> document , parentNode , nodes , nodesc ) != SUCCESS )) {
562
+ return ;
563
+ }
564
+
565
565
/* Spec step 3: find first following child not in nodes; otherwise null */
566
566
xmlNodePtr viable_next_sibling = child -> next ;
567
567
while (viable_next_sibling ) {
@@ -571,10 +571,6 @@ void dom_child_replace_with(dom_object *context, zval *nodes, uint32_t nodesc)
571
571
viable_next_sibling = viable_next_sibling -> next ;
572
572
}
573
573
574
- if (UNEXPECTED (dom_sanity_check_node_list_for_insertion (context -> document , parentNode , nodes , nodesc ) != SUCCESS )) {
575
- return ;
576
- }
577
-
578
574
php_libxml_invalidate_node_list_cache_from_doc (context -> document -> ptr );
579
575
580
576
/* Spec step 4: convert nodes into fragment */
0 commit comments