]> granicus.if.org Git - php/commitdiff
Fix seeking
authorMarcus Boerger <helly@php.net>
Tue, 31 Aug 2004 20:54:00 +0000 (20:54 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 31 Aug 2004 20:54:00 +0000 (20:54 +0000)
ext/spl/spl_array.c

index 901bd35552babb9378c307cf8478f02e7d9ac0c9..34645a18efc2e65115503256f9d4978b06397e8a 100755 (executable)
@@ -716,7 +716,7 @@ SPL_METHOD(Array, seek)
 
        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 @@ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{
                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;