~ubuntu-branches/ubuntu/quantal/php5/quantal

« back to all changes in this revision

Viewing changes to ext/standard/tests/array/sizeof_error.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Sean Finney
  • Date: 2009-07-01 09:12:10 UTC
  • mto: (0.9.1) (1.1.17 upstream)
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: james.westby@ubuntu.com-20090701091210-go0h6506p62on17r
Tags: upstream-5.3.0
ImportĀ upstreamĀ versionĀ 5.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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