File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / output / ob_start_error_001.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_3_10, HEAD
php

    1: --TEST--
    2: Test wrong number of arguments and wrong arg types for ob_start()
    3: --FILE--
    4: <?php
    5: /* 
    6:  * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
    7:  * Function is implemented in main/output.c
    8: */ 
    9: 
   10: function justPrint($str) {
   11: 	return $str;
   12: }
   13: 
   14: $arg_1 = "justPrint";
   15: $arg_2 = 0;
   16: $arg_3 = false;
   17: $extra_arg = 1;
   18: 
   19: echo "\n- Too many arguments\n";
   20: var_dump(ob_start($arg_1, $arg_2, $arg_3, $extra_arg));
   21: 
   22: echo "\n- Arg 1 wrong type\n";
   23: var_dump(ob_start(1.5));
   24: 
   25: echo "\n- Arg 2 wrong type\n";
   26: var_dump(ob_start("justPrint", "this should be an int"));
   27: 
   28: echo "\n- Arg 3 wrong type\n";
   29: var_dump(ob_start("justPrint", 0, "this should be a bool"));
   30: 
   31: ?>
   32: --EXPECTF--
   33: 
   34: - Too many arguments
   35: 
   36: Warning: ob_start() expects at most 3 parameters, 4 given in %s on line 17
   37: NULL
   38: 
   39: - Arg 1 wrong type
   40: bool(true)
   41: 
   42: - Arg 2 wrong type
   43: 
   44: Warning: ob_start() expects parameter 2 to be long, string given in %s on line 23
   45: NULL
   46: 
   47: - Arg 3 wrong type
   48: bool(true)

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