1--TEST--
2Test htmlspecialchars_decode() function : error conditions
3--FILE--
4<?php
5/* Prototype  : string htmlspecialchars_decode(string $string [, int $quote_style])
6 * Description: Convert special HTML entities back to characters
7 * Source code: ext/standard/html.c
8*/
9
10echo "*** Testing htmlspecialchars_decode() : error conditions ***\n";
11
12// Zero arguments
13echo "\n-- Testing htmlspecialchars_decode() function with Zero arguments --\n";
14var_dump( htmlspecialchars_decode() );
15
16//Test htmlspecialchars_decode with one more than the expected number of arguments
17echo "\n-- Testing htmlspecialchars_decode() function with more than expected no. of arguments --\n";
18$string = "<html>hello &amp; &gt; &lt; &quot; &#039; world</html>";
19$quote_style = ENT_COMPAT;
20$extra_arg = 10;
21var_dump( htmlspecialchars_decode($string, $quote_style, $extra_arg) );
22
23echo "Done";
24?>
25--EXPECTF--
26*** Testing htmlspecialchars_decode() : error conditions ***
27
28-- Testing htmlspecialchars_decode() function with Zero arguments --
29
30Warning: htmlspecialchars_decode() expects at least 1 parameter, 0 given in %s on line %d
31NULL
32
33-- Testing htmlspecialchars_decode() function with more than expected no. of arguments --
34
35Warning: htmlspecialchars_decode() expects at most 2 parameters, 3 given in %s on line %d
36NULL
37Done
38