1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/ext/standard/tests/array/array_fill_variation6.phpt
Christoph M. Becker a1b05a3a40 Tweak $count range check of array_fill()
We fix the `UNEXPECTED(EXPECTED(…))`, which does not make sense, and
replace the magic number with the respective macro.   We also add a
test case to verify the expected behavior for an `array_fill()` edge
case.

Closes GH-8804.
2022-06-21 11:39:05 +02:00

20 lines
347 B
PHP

--TEST--
array_fill(): last element
--FILE--
<?php
$a = array_fill(PHP_INT_MAX, 1, "foo");
var_dump(
count($a),
array_key_exists(PHP_INT_MAX, $a),
);
try {
$a[] = "bar";
} catch (Error $ex) {
echo $ex->getMessage(), PHP_EOL;
}
?>
--EXPECT--
int(1)
bool(true)
Cannot add element to the array as the next element is already occupied