summaryrefslogtreecommitdiff
path: root/ext/simplexml
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2004-01-21 11:32:30 +0000
committerRob Richards <rrichards@php.net>2004-01-21 11:32:30 +0000
commit500fa86c1b8ec093cf2f734139ac9e769595e6ac (patch)
tree27ff72eaec7fe7f3106afb587f150f7fc2d732f5 /ext/simplexml
parent8992afd3dcf5ff80c6d5a35c625e8aadf42130a2 (diff)
downloadphp-git-500fa86c1b8ec093cf2f734139ac9e769595e6ac.tar.gz
Fix Bug #26976 (Can not access array elements using array indices)
return index 0 as non iterable object update test
Diffstat (limited to 'ext/simplexml')
-rw-r--r--ext/simplexml/simplexml.c13
-rw-r--r--ext/simplexml/tests/015.phpt6
2 files changed, 6 insertions, 13 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index c989571968..7b4567dfc0 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -191,21 +191,17 @@ static zval * sxe_prop_dim_read(zval *object, zval *member, zend_bool elements,
node = NULL;
}
- if (node) {
- node = node->next;
- }
-
prefix = sxe->iter.nsprefix;
- while (node && nodendx < Z_TYPE_P(member)) {
+ while (node && nodendx <= Z_LVAL_P(member)) {
SKIP_TEXT(node)
if (node->type == XML_ELEMENT_NODE) {
if (match_ns(sxe, node, prefix)) {
if (sxe->iter.type == SXE_ITER_ELEMENT && !xmlStrcmp(node->name, sxe->iter.name)) {
- nodendx++;
- if (nodendx == Z_TYPE_P(member)) {
+ if (nodendx == Z_LVAL_P(member)) {
break;
}
+ nodendx++;
}
} else {
break;
@@ -246,9 +242,6 @@ static zval * sxe_property_read(zval *object, zval *member, zend_bool silent TSR
*/
static zval * sxe_dimension_read(zval *object, zval *offset TSRMLS_DC)
{
- if (Z_TYPE_P(offset) == IS_LONG && Z_LVAL_P(offset) == 0) {
- return object;
- }
return sxe_prop_dim_read(object, offset, 0, 1, 0 TSRMLS_CC);
}
/* }}} */
diff --git a/ext/simplexml/tests/015.phpt b/ext/simplexml/tests/015.phpt
index b134354d79..8b9de2b0a6 100644
--- a/ext/simplexml/tests/015.phpt
+++ b/ext/simplexml/tests/015.phpt
@@ -41,15 +41,15 @@ object(simplexml_element)#4 (1) {
[0]=>
string(3) "Joe"
}
-object(simplexml_element)#3 (1) {
+object(simplexml_element)#4 (1) {
[0]=>
string(3) "Joe"
}
-object(simplexml_element)#2 (1) {
+object(simplexml_element)#1 (1) {
[0]=>
string(3) "Joe"
}
-object(simplexml_element)#2 (1) {
+object(simplexml_element)#1 (1) {
[0]=>
string(3) "Boe"
}