1--TEST--
2Test mcrypt_cbc() function : error conditions
3--SKIPIF--
4<?php
5if (!extension_loaded("mcrypt")) {
6	print "skip - mcrypt extension not loaded";
7}
8?>
9--FILE--
10<?php
11/* Prototype  : string mcrypt_cbc(int cipher, string key, string data, int mode, string iv)
12 * Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv
13 * Source code: ext/mcrypt/mcrypt.c
14 * Alias to functions:
15 */
16
17echo "*** Testing mcrypt_cbc() : error conditions ***\n";
18
19
20//Test mcrypt_cbc with one more than the expected number of arguments
21echo "\n-- Testing mcrypt_cbc() function with more than expected no. of arguments --\n";
22$cipher = 10;
23$key = 'string_val';
24$data = 'string_val';
25$mode = 10;
26$iv = 'string_val';
27$extra_arg = 10;
28var_dump( mcrypt_cbc($cipher, $key, $data, $mode, $iv, $extra_arg) );
29
30// Testing mcrypt_cbc with one less than the expected number of arguments
31echo "\n-- Testing mcrypt_cbc() function with less than expected no. of arguments --\n";
32$cipher = 10;
33$key = 'string_val';
34$data = 'string_val';
35var_dump( mcrypt_cbc($cipher, $key, $data) );
36
37?>
38===DONE===
39--EXPECTF--
40*** Testing mcrypt_cbc() : error conditions ***
41
42-- Testing mcrypt_cbc() function with more than expected no. of arguments --
43
44Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
45
46Warning: mcrypt_cbc() expects at most 5 parameters, 6 given in %s on line %d
47NULL
48
49-- Testing mcrypt_cbc() function with less than expected no. of arguments --
50
51Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
52
53Warning: mcrypt_cbc() expects at least 4 parameters, 3 given in %s on line %d
54NULL
55===DONE===
56
57