Annotation of embedaddon/php/ext/standard/tests/array/array_push_error2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test array_push() function : error conditions - max int value as key
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : int array_push(array $stack, mixed $var [, mixed $...])
                      6:  * Description: Pushes elements onto the end of the array 
                      7:  * Source code: ext/standard/array.c
                      8:  */
                      9: 
                     10: /*
                     11:  * Use PHP's maximum integer value as array key
                     12:  * then try and push new elements onto the array
                     13:  */
                     14: 
                     15: echo "*** Testing array_push() : error conditions ***\n";
                     16: 
                     17: $array = array(PHP_INT_MAX => 'max');
                     18: 
                     19: var_dump(array_push($array, 'new'));
                     20: var_dump($array);
                     21: 
                     22: echo "Done";
                     23: ?>
                     24: 
                     25: --EXPECTF--
                     26: *** Testing array_push() : error conditions ***
                     27: 
                     28: Warning: array_push(): Cannot add element to the array as the next element is already occupied in %s on line %d
                     29: bool(false)
                     30: array(1) {
                     31:   [%d]=>
                     32:   string(3) "max"
                     33: }
                     34: Done

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