1--TEST--
2Test str_pad() function : usage variations - large values for '$pad_length' argument
3--SKIPIF--
4<?php
5if (getenv("USE_ZEND_ALLOC") === "0") {
6    die("skip Zend MM disabled");
7}
8?>
9--FILE--
10<?php
11/* Test str_pad() function: with unexpected inputs for '$pad_length'
12 *  and expected type for '$input'
13*/
14
15echo "*** Testing str_pad() function: with large value for for 'pad_length' argument ***\n";
16
17//defining '$input' argument
18$input = "Test string";
19
20$extra_large_pad_length = PHP_INT_MAX*5;
21try {
22    var_dump( str_pad($input, $extra_large_pad_length) );
23} catch (\TypeError $e) {
24    echo $e->getMessage() . "\n";
25}
26
27$php_int_max_pad_length = PHP_INT_MAX;
28var_dump( str_pad($input, $php_int_max_pad_length) );
29
30
31?>
32--EXPECTF--
33*** Testing str_pad() function: with large value for for 'pad_length' argument ***
34str_pad(): Argument #2 ($length) must be of type int, float given
35
36Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
37