Skip to content

Commit a9b656b

Browse files
committed
Fix arginfo/ZPP mismatch for simplexml_import_dom
1 parent 23a192d commit a9b656b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ext/simplexml/simplexml.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,8 +2619,6 @@ PHP_FUNCTION(simplexml_import_dom)
26192619
RETURN_THROWS();
26202620
}
26212621

2622-
object = Z_LIBXML_NODE_P(node);
2623-
26242622
nodep = php_libxml_import_node(node);
26252623

26262624
if (nodep) {
@@ -2631,15 +2629,21 @@ PHP_FUNCTION(simplexml_import_dom)
26312629
if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) {
26322630
nodep = xmlDocGetRootElement((xmlDocPtr) nodep);
26332631
}
2632+
} else {
2633+
zend_argument_type_error(1, "must be of type DOMNode, %s given", zend_zval_type_name(node));
2634+
RETURN_THROWS();
26342635
}
26352636

2636-
if (nodep && nodep->type == XML_ELEMENT_NODE) {
2637+
if (nodep->type == XML_ELEMENT_NODE) {
26372638
if (!ce) {
26382639
ce = sxe_class_entry;
26392640
fptr_count = NULL;
26402641
} else {
26412642
fptr_count = php_sxe_find_fptr_count(ce);
26422643
}
2644+
2645+
object = Z_LIBXML_NODE_P(node);
2646+
26432647
sxe = php_sxe_object_new(ce, fptr_count);
26442648
sxe->document = object->document;
26452649
php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, nodep->doc);

0 commit comments

Comments
 (0)