helly           Fri Apr 14 15:19:45 2006 UTC

  Added files:                 (Branch: PHP_5_1)
    /php-src/ext/simplexml/tests        009b.phpt 

  Modified files:              
    /php-src/ext/simplexml      simplexml.c 
  Log:
  - MFH Fix properties access to children() result
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/simplexml.c?r1=1.151.2.21&r2=1.151.2.22&diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.151.2.21 
php-src/ext/simplexml/simplexml.c:1.151.2.22
--- php-src/ext/simplexml/simplexml.c:1.151.2.21        Mon Apr 10 23:23:09 2006
+++ php-src/ext/simplexml/simplexml.c   Fri Apr 14 15:19:45 2006
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.151.2.21 2006/04/10 23:23:09 helly Exp $ */
+/* $Id: simplexml.c,v 1.151.2.22 2006/04/14 15:19:45 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -989,7 +989,7 @@
                        ZVAL_STRING(value, sxe_xmlNodeListGetString(node->doc, 
node->children, 1), 0);
                        zend_hash_next_index_insert(rv, &value, sizeof(zval *), 
NULL);
                        node = NULL;
-               } else {
+               } else if (sxe->iter.type != SXE_ITER_CHILD) {
                        node = node->children;
                }
 
@@ -2310,7 +2310,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_header(2, "Simplexml support", "enabled");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.21 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22 $");
        php_info_print_table_row(2, "Schema support",
 #ifdef LIBXML_SCHEMAS_ENABLED
                "enabled");

http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/tests/009b.phpt?view=markup&rev=1.1
Index: php-src/ext/simplexml/tests/009b.phpt
+++ php-src/ext/simplexml/tests/009b.phpt
--TEST--
SimpleXML: foreach 
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php 
$sxe = simplexml_load_string(<<<EOF
<?xml version='1.0'?>
<!DOCTYPE sxe SYSTEM "notfound.dtd">
<sxe id="elem1">
 Plain text.
 <elem1 attr1='first'>Bla bla 1.<!-- comment --><elem2>
   Here we have some text data.
  </elem2></elem1>
 <elem11 attr2='second'>Bla bla 2.</elem11>
</sxe>
EOF
);
var_dump($sxe->children());
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(SimpleXMLElement)#%d (3) {
  ["@attributes"]=>
  array(1) {
    ["id"]=>
    string(5) "elem1"
  }
  ["elem1"]=>
  string(10) "Bla bla 1."
  ["elem11"]=>
  string(10) "Bla bla 2."
}
===DONE===
--UEXPECTF--
object(SimpleXMLElement)#%d (3) {
  [u"@attributes"]=>
  array(1) {
    [u"id"]=>
    unicode(5) "elem1"
  }
  [u"elem1"]=>
  unicode(10) "Bla bla 1."
  [u"elem11"]=>
  unicode(10) "Bla bla 2."
}
===DONE===

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

Reply via email to