diff options
author | Nikita Popov <nikic@php.net> | 2016-08-30 10:55:08 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2016-08-30 10:56:06 +0200 |
commit | 51a564e50557093ec42206301d097dd4f2127acb (patch) | |
tree | 5d361472247916bc3627488005a6170139f8767c /ext | |
parent | 4a12450de2c0be6b456ef6dca628671b67b0c7a6 (diff) | |
parent | 07cc6a6ba2d8cebe2b375353491a26953b250149 (diff) | |
download | php-git-51a564e50557093ec42206301d097dd4f2127acb.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.1
Diffstat (limited to 'ext')
-rw-r--r-- | ext/simplexml/simplexml.c | 4 | ||||
-rw-r--r-- | ext/simplexml/tests/bug72971.phpt | 21 |
2 files changed, 23 insertions, 2 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 622ff3b6ec..d26f68ee26 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -809,7 +809,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend while (node) { xmlNodePtr nnext; nnext = node->next; - if ((node->type == XML_ELEMENT_NODE) && !xmlStrcmp(node->name, (xmlChar *)Z_STRVAL_P(member))) { + if (node->type == XML_ELEMENT_NODE && !xmlStrcmp(node->name, (xmlChar *)Z_STRVAL_P(member)) && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix)) { break; } node = nnext; @@ -939,7 +939,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, SKIP_TEXT(node); - if (!xmlStrcmp(node->name, (xmlChar *)Z_STRVAL_P(member))) { + if (!xmlStrcmp(node->name, (xmlChar *)Z_STRVAL_P(member)) && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix)) { xmlUnlinkNode(node); php_libxml_node_free_resource(node); } diff --git a/ext/simplexml/tests/bug72971.phpt b/ext/simplexml/tests/bug72971.phpt new file mode 100644 index 0000000000..ff7ded02ef --- /dev/null +++ b/ext/simplexml/tests/bug72971.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #72971: SimpleXML isset/unset do not respect namespace +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?> +--FILE-- +<?php + +$xml = new SimpleXMLElement('<root xmlns:ns="ns"><foo>bar</foo><ns:foo>ns:bar</ns:foo><ns:foo2>ns:bar2</ns:foo2></root>'); +var_dump(isset($xml->foo2)); +unset($xml->foo); +var_dump($xml->children('ns')); + +?> +--EXPECT-- +bool(false) +object(SimpleXMLElement)#2 (2) { + ["foo"]=> + string(6) "ns:bar" + ["foo2"]=> + string(7) "ns:bar2" +} |