com php-src: fix regression introduced in 5683b6fa39: ext/simplexml/simplexml.c ext/simplexml/tests/bug6608 4_1.phpt

From: Date: Tue, 08 Mar 2016 11:59:59 +0000
Subject: com php-src: fix regression introduced in 5683b6fa39: ext/simplexml/simplexml.c ext/simplexml/tests/bug6608 4_1.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91285@lists.php.net to get a copy of this message
Commit: 8ca02bb233978493d9299a8abd29f01d1077bea6 Author: Anatol Belski <ab@php.net> Tue, 8 Mar 2016 12:59:59 +0100 Parents: 2d4ad66ff2e9f64e23461325f3c73bd5791653c2 Branches: PHP-5.6 PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8ca02bb233978493d9299a8abd29f01d1077bea6 Log: fix regression introduced in 5683b6fa39 Test extended. Basically, both iterator type and next node have to be checked. Changed paths: M ext/simplexml/simplexml.c M ext/simplexml/tests/bug66084_1.phpt Diff: diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index af26634..07fc654 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml..c @@ -1129,7 +1129,7 @@ static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{ node = NULL; } else if (sxe->iter.type != SXE_ITER_CHILD) { - if ( sxe->iter.type == SXE_ITER_NONE || !node->children || !node->parent || node->children->next || node->children->children || node->parent->children == node->parent->last ) { + if ( sxe->iter.type == SXE_ITER_NONE || !node->children || !node->parent || !node->next || node->children->next || node->children->children || node->parent->children == node->parent->last ) { node = node->children; } else { iter_data = sxe->iter.data; diff --git a/ext/simplexml/tests/bug66084_1.phpt b/ext/simplexml/tests/bug66084_1.phpt index 80e91df..85ab10e 100644 --- a/ext/simplexml/tests/bug66084_1.phpt +++ b/ext/simplexml/tests/bug66084_1.phpt @@ -5,12 +5,14 @@ Bug #66084 simplexml_load_string() mangles empty node name, json variant <?php if (!extension_loaded("json")) print "skip json not available"; ?> --FILE-- <?php +echo json_encode(simplexml_load_string('<a><b/><c><x/></c></a>')->c), "\n"; echo json_encode(simplexml_load_string('<a><b/><c><x/></c></a>')), "\n"; echo json_encode(simplexml_load_string('<a><b/><d/><c><x/></c></a>')), "\n"; echo json_encode(simplexml_load_string('<a><b/><c><d/><x/></c></a>')), "\n"; echo json_encode(simplexml_load_string('<a><b/><c><d><x/></d></c></a>')), "\n"; ?> --EXPECT-- +{"x":{}} {"b":{},"c":{"x":{}}} {"b":{},"d":{},"c":{"x":{}}} {"b":{},"c":{"d":{},"x":{}}}

« previous php.cvs (#91285) next »