|
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 |
| -echo "*** Testing array_fill() : error conditions ***\n"; |
8 |
| - |
9 |
| -$intMax = 2147483647; |
10 |
| - |
11 |
| -// calling array_fill() with 'count' larger than INT_MAX |
12 |
| -try { |
13 |
| - $array = array_fill(0, $intMax+1, 1); |
14 |
| -} catch (\ValueError $e) { |
15 |
| - echo $e->getMessage() . "\n"; |
16 |
| -} |
17 |
| - |
18 |
| -// calling array_fill() with 'count' equals to INT_MAX |
19 |
| -$array = array_fill(0, $intMax, 1); |
20 |
| - |
21 |
| -?> |
22 |
| ---EXPECTF-- |
23 |
| -*** Testing array_fill() : error conditions *** |
24 |
| -array_fill(): Argument #2 ($count) is too large |
25 |
| - |
26 |
| -Fatal error: Possible integer overflow in memory allocation (%d * %d + %d) in %s on line %d |
| 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 | +echo "*** Testing array_fill() : error conditions ***\n"; |
| 8 | + |
| 9 | +$intMax = 2147483647; |
| 10 | + |
| 11 | +// calling array_fill() with 'count' larger than INT_MAX |
| 12 | +try { |
| 13 | + $array = array_fill(0, $intMax+1, 1); |
| 14 | +} catch (\ValueError $e) { |
| 15 | + echo $e->getMessage() . "\n"; |
| 16 | +} |
| 17 | + |
| 18 | +// calling array_fill() with 'count' equals to INT_MAX |
| 19 | +$array = array_fill(0, $intMax, 1); |
| 20 | + |
| 21 | +?> |
| 22 | +--EXPECTF-- |
| 23 | +*** Testing array_fill() : error conditions *** |
| 24 | +array_fill(): Argument #2 ($count) is too large |
| 25 | + |
| 26 | +Fatal error: Possible integer overflow in memory allocation (%d * %d + %d) in %s on line %d |
0 commit comments