mirror of
https://github.com/php/php-src.git
synced 2025-01-20 10:43:40 +08:00
Corrected typo in LimitIterator offset exception. Fixes #51119
This commit is contained in:
parent
e8be606367
commit
fbbe3e3686
@ -1272,7 +1272,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
|
||||
return NULL;
|
||||
}
|
||||
if (intern->u.limit.offset < 0) {
|
||||
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);
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return NULL;
|
||||
}
|
||||
|
34
ext/spl/tests/bug51119.phpt
Normal file
34
ext/spl/tests/bug51119.phpt
Normal file
@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
SPL: LimitIterator zero is valid offset
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = array('a', 'b', 'c');
|
||||
$arrayIterator = new ArrayIterator($array);
|
||||
|
||||
try {
|
||||
$limitIterator = new LimitIterator($arrayIterator, 0);
|
||||
foreach ($limitIterator as $item) {
|
||||
echo $item . "\n";
|
||||
}
|
||||
} catch (OutOfRangeException $e){
|
||||
print $e->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===
|
@ -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===
|
||||
|
Loading…
Reference in New Issue
Block a user