Annotation of embedaddon/php/ext/standard/tests/strings/str_pad_variation5.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test str_pad() function : usage variations - unexpected large value for '$pad_length' argument
                      3: --INI--
                      4: memory_limit=128M
                      5: --SKIPIF--
                      6: <?php
                      7: if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
1.1.1.2 ! misho       8: if (getenv("USE_ZEND_ALLOC") === "0") {
        !             9:     die("skip Zend MM disabled");
        !            10: }
1.1       misho      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: 
                     23: echo "*** 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;
                     28: var_dump( str_pad($input, $pad_length) );
                     29: 
                     30: ?>
                     31: --EXPECTF--
                     32: *** Testing str_pad() function: with large value for for 'pad_length' argument ***
                     33: 
                     34: Fatal error: Allowed memory size of 134217728 bytes exhausted%s(tried to allocate 2147483648 bytes) in %s on line %d

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>