cvs: php-src(PHP_5_2) /ext/spl spl_sxe.c /ext/spl/tests bug42259.phpt

From: Date: Tue, 14 Aug 2007 12:10:46 +0000
Subject: cvs: php-src(PHP_5_2) /ext/spl spl_sxe.c /ext/spl/tests bug42259.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-45897@lists.php.net to get a copy of this message
rrichards Tue Aug 14 12:10:46 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug42259.phpt Modified files: /php-src/ext/spl spl_sxe.c Log: MFH: fix bug #42259 (SimpleXMLIterator loses ancestry) add test http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_sxe.c?r1=1.8.2.5.2.1&r2=1.8.2.5.2.2&diff_format=u Index: php-src/ext/spl/spl_sxe.c diff -u php-src/ext/spl/spl_sxe.c:1.8.2.5.2.1 php-src/ext/spl/spl_sxe.c:1.8.2.5.2.2 --- php-src/ext/spl/spl_sxe.c:1.8.2.5.2.1 Mon Jan 1 09:36:07 2007 +++ php-src/ext/spl/spl_sxe.c Tue Aug 14 12:10:46 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_sxe.c,v 1.8.2.5.2.1 2007/01/01 09:36:07 sebastian Exp $ */ +/* $Id: spl_sxe.c,v 1.8.2.5.2.2 2007/08/14 12:10:46 rrichards Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -142,8 +142,7 @@ if (!sxe->iter.data || sxe->iter.type == SXE_ITER_ATTRLIST) { return; /* return NULL */ } - return_value->type = IS_OBJECT; - return_value->value.obj = zend_objects_store_clone_obj(sxe->iter.data TSRMLS_CC); + RETURN_ZVAL(sxe->iter.data, 1, 0); } /* {{{ proto int SimpleXMLIterator::count() http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42259.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/bug42259.phpt +++ php-src/ext/spl/tests/bug42259.phpt --TEST-- Bug #42259 (SimpleXMLIterator loses ancestry) --SKIPIF-- if (!extension_loaded("spl")) print "skip"; if (!extension_loaded('simplexml')) print 'skip'; if (!extension_loaded("libxml")) print "skip LibXML not present"; if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available'; --FILE-- <?php $xml =<<<EOF <xml> <fieldset1> <field1/> <field2/> </fieldset1> <fieldset2> <options> <option1/> <option2/> <option3/> </options> <field1/> <field2/> </fieldset2> </xml> EOF; $sxe = new SimpleXMLIterator($xml); $rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::LEAVES_ONLY); foreach ($rit as $child) { $path = ''; $ancestry = $child->xpath('ancestor-or-self::*'); foreach ($ancestry as $ancestor) { $path .= $ancestor->getName() . '/'; } $path = substr($path, 0, strlen($path) - 1); echo count($ancestry) . ' steps: ' . $path . PHP_EOL; } ?> ===DONE=== --EXPECT-- 3 steps: xml/fieldset1/field1 3 steps: xml/fieldset1/field2 4 steps: xml/fieldset2/options/option1 4 steps: xml/fieldset2/options/option2 4 steps: xml/fieldset2/options/option3 3 steps: xml/fieldset2/field1 3 steps: xml/fieldset2/field2 ===DONE===

« previous php.cvs (#45897) next »