]> granicus.if.org Git - php/commitdiff
- Make start and length parameter to Limititerator::__construct optional
authorMarcus Boerger <helly@php.net>
Tue, 18 May 2004 20:39:35 +0000 (20:39 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 18 May 2004 20:39:35 +0000 (20:39 +0000)
ext/spl/spl_iterators.c

index 61934b9035f5c48216ea64f5f514c17f2a228c99..3eb1b50dd4020b74d21f18e90eb9c089a368964f 100755 (executable)
@@ -563,8 +563,9 @@ static INLINE spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME
        intern->dit_type = dit_type;
        switch (dit_type) {
                case DIT_LimitIterator: {
+                       intern->u.limit.offset = 0; /* start at beginning */
                        intern->u.limit.count = -1; /* get all */
-                       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol|l", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
+                       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
                                php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
                                return NULL;
                        }
@@ -984,7 +985,7 @@ static INLINE void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS
        }
 }
 
-/* {{{ proto LimitIterator:__construct(Iterator $it, int $offset [, int $count])
+/* {{{ proto LimitIterator:__construct(Iterator $it [, int $offset, int $count])
    Construct a LimitIterator from an Iterator with a given starting offset and optionally a maximum count */
 SPL_METHOD(LimitIterator, __construct)
 {