From: Anatol Belski Date: Tue, 8 Mar 2016 11:59:59 +0000 (+0100) Subject: fix regression introduced in 5683b6fa39 X-Git-Tag: php-5.6.20RC1~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ca02bb233978493d9299a8abd29f01d1077bea6;p=php fix regression introduced in 5683b6fa39 Test extended. Basically, both iterator type and next node have to be checked. --- diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index af266348a3..07fc6546e8 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 80e91df7c6..85ab10ee59 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 --FILE-- ')->c), "\n"; echo json_encode(simplexml_load_string('')), "\n"; echo json_encode(simplexml_load_string('')), "\n"; echo json_encode(simplexml_load_string('')), "\n"; echo json_encode(simplexml_load_string('')), "\n"; ?> --EXPECT-- +{"x":{}} {"b":{},"c":{"x":{}}} {"b":{},"d":{},"c":{"x":{}}} {"b":{},"c":{"d":{},"x":{}}}