rrichards               Wed Jan 21 06:32:31 2004 EDT

  Modified files:              
    /php-src/ext/simplexml      simplexml.c 
    /php-src/ext/simplexml/tests        015.phpt 
  Log:
  Fix Bug #26976 (Can not access array elements using array indices)
  return index 0 as non iterable object
  update test
  
http://cvs.php.net/diff.php/php-src/ext/simplexml/simplexml.c?r1=1.119&r2=1.120&ty=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.119 php-src/ext/simplexml/simplexml.c:1.120
--- php-src/ext/simplexml/simplexml.c:1.119     Tue Jan 20 20:09:41 2004
+++ php-src/ext/simplexml/simplexml.c   Wed Jan 21 06:32:29 2004
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.119 2004/01/21 01:09:41 sniper Exp $ */
+/* $Id: simplexml.c,v 1.120 2004/01/21 11:32:29 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -191,21 +191,17 @@
                                        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_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);
 }
 /* }}} */
@@ -1529,7 +1522,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_header(2, "Simplexml support", "enabled");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.119 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.120 $");
        php_info_print_table_row(2, "Schema support", 
 #ifdef LIBXML_SCHEMAS_ENABLED
                "enabled");
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/015.phpt?r1=1.3&r2=1.4&ty=u
Index: php-src/ext/simplexml/tests/015.phpt
diff -u php-src/ext/simplexml/tests/015.phpt:1.3 
php-src/ext/simplexml/tests/015.phpt:1.4
--- php-src/ext/simplexml/tests/015.phpt:1.3    Sat Jan 17 14:41:32 2004
+++ php-src/ext/simplexml/tests/015.phpt        Wed Jan 21 06:32:30 2004
@@ -41,15 +41,15 @@
   [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"
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to