We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a9d11b6 commit bb38ad7Copy full SHA for bb38ad7
ext/standard/tests/array/array_fill_error2.phpt
@@ -0,0 +1,23 @@
1
+--TEST--
2
+Test array_fill() function : error conditions - count is too large
3
+--SKIPIF--
4
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
5
+--FILE--
6
+<?php
7
+$intMax = 2147483647;
8
+
9
+// calling array_fill() with 'count' larger than INT_MAX
10
+try {
11
+ $array = array_fill(0, $intMax+1, 1);
12
+} catch (\ValueError $e) {
13
+ echo $e->getMessage() . "\n";
14
+}
15
16
+// calling array_fill() with 'count' equals to INT_MAX
17
+$array = array_fill(0, $intMax, 1);
18
19
+?>
20
+--EXPECTF--
21
+array_fill(): Argument #2 ($count) is too large
22
23
+Fatal error: Possible integer overflow in memory allocation (%d * %d + %d) in %s on line %d
0 commit comments