From: Peter Cowburn Date: Mon, 22 Feb 2010 23:55:30 +0000 (+0000) Subject: Corrected typo in LimitIterator offset exception. Fixes #51119 X-Git-Tag: php-5.2.13~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d10ba88769fc1083f989ae7ba53d733bac9ef1b3;p=php Corrected typo in LimitIterator offset exception. Fixes #51119 --- diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 3c76867a85..07f47680de 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -923,7 +923,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z } if (intern->u.limit.offset < 0) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be > 0", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be >= 0", 0 TSRMLS_CC); return NULL; } if (intern->u.limit.count < 0 && intern->u.limit.count != -1) { diff --git a/ext/spl/tests/bug51119.phpt b/ext/spl/tests/bug51119.phpt new file mode 100644 index 0000000000..441aa1280a --- /dev/null +++ b/ext/spl/tests/bug51119.phpt @@ -0,0 +1,34 @@ +--TEST-- +SPL: LimitIterator zero is valid offset +--FILE-- +getMessage() . "\n"; +} + +try { + $limitIterator = new LimitIterator($arrayIterator, -1); + foreach ($limitIterator as $item) { + echo $item . "\n"; + } +} catch (OutOfRangeException $e){ + print $e->getMessage() . "\n"; +} + +?> +===DONE=== +--EXPECT-- +a +b +c +Parameter offset must be >= 0 +===DONE=== diff --git a/ext/spl/tests/spl_limit_iterator_check_limits.phpt b/ext/spl/tests/spl_limit_iterator_check_limits.phpt index 01436a8fbe..ae1bc85e89 100644 --- a/ext/spl/tests/spl_limit_iterator_check_limits.phpt +++ b/ext/spl/tests/spl_limit_iterator_check_limits.phpt @@ -32,6 +32,6 @@ try { ?> ===DONE=== --EXPECTF-- -Parameter offset must be > 0 +Parameter offset must be >= 0 Parameter count must either be -1 or a value greater than or equal 0 ===DONE===