1--TEST--
2Test str_pad() function : usage variations - unexpected large value for '$pad_length' argument
3--INI--
4memory_limit=128M
5--SKIPIF--
6<?php
7if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
8if (getenv("USE_ZEND_ALLOC") === "0") {
9    die("skip Zend MM disabled");
10}
11?>
12--FILE--
13<?php
14/* Prototype  : string str_pad  ( string $input  , int $pad_length  [, string $pad_string  [, int $pad_type  ]] )
15 * Description: Pad a string to a certain length with another string
16 * Source code: ext/standard/string.c
17*/
18
19/* Test str_pad() function: with unexpected inputs for '$pad_length'
20 *  and expected type for '$input'
21*/
22
23echo "*** Testing str_pad() function: with large value for for 'pad_length' argument ***\n";
24
25//defining '$input' argument
26$input = "Test string";
27$pad_length = PHP_INT_MAX;
28var_dump( str_pad($input, $pad_length) );
29
30?>
31--EXPECTF--
32*** Testing str_pad() function: with large value for for 'pad_length' argument ***
33
34Fatal error: Allowed memory size of 134217728 bytes exhausted%s(tried to allocate 2147483648 bytes) in %s on line %d
35