helly Tue Aug 31 16:56:08 2004 EDT Added files: (Branch: PHP_5_0) /php-src/ext/spl/tests array_014.phpt
Modified files: /php-src/ext/spl spl_array.c Log: MFH: Fix seeking http://cvs.php.net/diff.php/php-src/ext/spl/spl_array.c?r1=1.49&r2=1.49.2.1&ty=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.49 php-src/ext/spl/spl_array.c:1.49.2.1 --- php-src/ext/spl/spl_array.c:1.49 Mon Jun 21 15:15:27 2004 +++ php-src/ext/spl/spl_array.c Tue Aug 31 16:56:08 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.49 2004/06/21 19:15:27 helly Exp $ */ +/* $Id: spl_array.c,v 1.49.2.1 2004/08/31 20:56:08 helly Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -716,7 +716,7 @@ zend_hash_internal_pointer_reset_ex(aht, &intern->pos); - while (position-- > 0 && spl_array_next(intern TSRMLS_CC)); + while (position-- > 0 && spl_array_next(intern TSRMLS_CC) == SUCCESS); } /* }}} */ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ @@ -737,9 +737,8 @@ pos = intern->pos; *count = 0; zend_hash_internal_pointer_reset_ex(aht, &intern->pos); - while(intern->pos) { + while(intern->pos && spl_array_next(intern TSRMLS_CC) == SUCCESS) { (*count)++; - spl_array_next(intern TSRMLS_CC); } intern->pos = pos; return SUCCESS; http://cvs.php.net/co.php/php-src/ext/spl/tests/array_014.phpt?r=1.1&p=1 Index: php-src/ext/spl/tests/array_014.phpt +++ php-src/ext/spl/tests/array_014.phpt --TEST-- SPL: ArrayIterator::seek() --SKIPIF-- <?php if (!extension_loaded("spl")) print "skip"; ?> --FILE-- <?php $it = new ArrayIterator(range(0,10)); var_dump($it->count()); $it->seek(5); var_dump($it->current()); $it->seek(4); var_dump($it->current()); $it->seek(-1); var_dump($it->current()); $it->seek(12); var_dump($it->current()); foreach($it as $v) { var_dump($v); } ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- int(11) int(5) int(4) int(0) NULL int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) ===DONE=== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php