1--TEST--
2Test nl2br() function : error conditions
3--FILE--
4<?php
5/* Prototype  : string nl2br(string $str)
6 * Description: Inserts HTML line breaks before all newlines in a string.
7 * Source code: ext/standard/string.c
8*/
9
10echo "*** Testing nl2br() : error conditions ***\n";
11
12// Zero arguments
13echo "\n-- Testing nl2br() function with Zero arguments --";
14var_dump( nl2br() );
15
16//Test nl2br with one more than the expected number of arguments
17echo "\n-- Testing nl2br() function with more than expected no. of arguments --";
18$str = 'string_val';
19$extra_arg = 10;
20var_dump( nl2br($str, true, $extra_arg) );
21
22echo "Done";
23?>
24--EXPECTF--
25*** Testing nl2br() : error conditions ***
26
27-- Testing nl2br() function with Zero arguments --
28Warning: nl2br() expects at least 1 parameter, 0 given in %s on line %d
29NULL
30
31-- Testing nl2br() function with more than expected no. of arguments --
32Warning: nl2br() expects at most 2 parameters, 3 given in %s on line %d
33NULL
34Done
35