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