1--TEST--
2Test json_encode() function : error conditions
3--SKIPIF--
4<?php
5if (!extension_loaded("json")) {
6 	die('skip JSON extension not available in this build');
7}
8?>
9--FILE--
10<?php
11/* Prototype  : string json_encode  ( mixed $value  [, int $options=0  ] )
12 * Description: Returns the JSON representation of a value
13 * Source code: ext/json/php_json.c
14 * Alias to functions:
15 */
16
17echo "*** Testing json_encode() : error conditions ***\n";
18
19echo "\n-- Testing json_encode() function with no arguments --\n";
20var_dump( json_encode() );
21
22echo "\n-- Testing json_encode() function with more than expected no. of arguments --\n";
23$extra_arg = 10;
24var_dump( json_encode("abc", 0, $extra_arg) );
25
26?>
27===Done===
28--EXPECTF--
29*** Testing json_encode() : error conditions ***
30
31-- Testing json_encode() function with no arguments --
32
33Warning: json_encode() expects at least 1 parameter, 0 given in %s on line %d
34NULL
35
36-- Testing json_encode() function with more than expected no. of arguments --
37
38Warning: json_encode() expects at most 2 parameters, 3 given in %s on line %d
39NULL
40===Done===
41