File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2619,8 +2619,6 @@ PHP_FUNCTION(simplexml_import_dom)
2619
2619
RETURN_THROWS ();
2620
2620
}
2621
2621
2622
- object = Z_LIBXML_NODE_P (node );
2623
-
2624
2622
nodep = php_libxml_import_node (node );
2625
2623
2626
2624
if (nodep ) {
@@ -2631,15 +2629,21 @@ PHP_FUNCTION(simplexml_import_dom)
2631
2629
if (nodep -> type == XML_DOCUMENT_NODE || nodep -> type == XML_HTML_DOCUMENT_NODE ) {
2632
2630
nodep = xmlDocGetRootElement ((xmlDocPtr ) nodep );
2633
2631
}
2632
+ } else {
2633
+ zend_argument_type_error (1 , "must be of type DOMNode, %s given" , zend_zval_type_name (node ));
2634
+ RETURN_THROWS ();
2634
2635
}
2635
2636
2636
- if (nodep && nodep -> type == XML_ELEMENT_NODE ) {
2637
+ if (nodep -> type == XML_ELEMENT_NODE ) {
2637
2638
if (!ce ) {
2638
2639
ce = sxe_class_entry ;
2639
2640
fptr_count = NULL ;
2640
2641
} else {
2641
2642
fptr_count = php_sxe_find_fptr_count (ce );
2642
2643
}
2644
+
2645
+ object = Z_LIBXML_NODE_P (node );
2646
+
2643
2647
sxe = php_sxe_object_new (ce , fptr_count );
2644
2648
sxe -> document = object -> document ;
2645
2649
php_libxml_increment_doc_ref ((php_libxml_node_object * )sxe , nodep -> doc );
You can’t perform that action at this time.
0 commit comments