Annotation of embedaddon/php/ext/standard/tests/array/sizeof_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test sizeof() function : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : int sizeof(mixed $var[, int $mode] )
! 6: * Description: Counts an elements in an array. If Standard PHP Library is installed,
! 7: * it will return the properties of an object.
! 8: * Source code: ext/standard/basic_functions.c
! 9: * Alias to functions: count()
! 10: */
! 11:
! 12: // Calling sizeof() with zero and more than expected arguments .
! 13:
! 14: echo "*** Testing sizeof() : error conditions ***\n";
! 15:
! 16: echo "-- Testing sizeof() with zero arguments --\n";
! 17: var_dump( sizeof() );
! 18: echo "-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --\n";
! 19: $var = 100;
! 20: $extra_arg = 10;;
! 21: var_dump( sizeof($var, COUNT_NORMAL, $extra_arg) );
! 22: echo "-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --\n";
! 23: var_dump( sizeof($var, COUNT_RECURSIVE, $extra_arg) );
! 24:
! 25: echo "Done";
! 26: ?>
! 27: --EXPECTF--
! 28: *** Testing sizeof() : error conditions ***
! 29: -- Testing sizeof() with zero arguments --
! 30:
! 31: Warning: sizeof() expects at least 1 parameter, 0 given in %s on line %d
! 32: NULL
! 33: -- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --
! 34:
! 35: Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d
! 36: NULL
! 37: -- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --
! 38:
! 39: Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d
! 40: NULL
! 41: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>