mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Remove array_pad's arbitrary length restriction The error message was wrong; it *is* possible to use a larger length. Furthermore, there is an arbitrary restriction on the new array's length. Fix both by checking the length against HT_MAX_SIZE.
21 lines
463 B
PHP
21 lines
463 B
PHP
--TEST--
|
|
array_pad() with too large padding should fail
|
|
--FILE--
|
|
<?php
|
|
|
|
function test($length) {
|
|
try {
|
|
var_dump(array_pad(array("", -1, 2.0), $length, 0));
|
|
} catch (\ValueError $e) {
|
|
echo $e->getMessage() . "\n";
|
|
}
|
|
}
|
|
|
|
test(PHP_INT_MIN);
|
|
test(PHP_INT_MAX);
|
|
|
|
?>
|
|
--EXPECT--
|
|
array_pad(): Argument #2 ($length) must not exceed the maximum allowed array size
|
|
array_pad(): Argument #2 ($length) must not exceed the maximum allowed array size
|