1--TEST--
2Test 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
14echo "*** Testing sizeof() : error conditions ***\n";
15
16echo "-- Testing sizeof() with zero arguments --\n";
17var_dump( sizeof() );
18echo "-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --\n";
19$var = 100;
20$extra_arg = 10;;
21var_dump( sizeof($var, COUNT_NORMAL, $extra_arg) );
22echo "-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --\n";
23var_dump( sizeof($var, COUNT_RECURSIVE, $extra_arg) );
24
25echo "Done";
26?>
27--EXPECTF--
28*** Testing sizeof() : error conditions ***
29-- Testing sizeof() with zero arguments --
30
31Warning: sizeof() expects at least 1 parameter, 0 given in %s on line %d
32NULL
33-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --
34
35Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d
36NULL
37-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --
38
39Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d
40NULL
41Done
42