1--TEST-- 2Test uniqid() function : error conditions 3--FILE-- 4<?php 5/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] ) 6 * Description: Gets a prefixed unique identifier based on the current time in microseconds. 7 * Source code: ext/standard/uniqid.c 8*/ 9echo "*** Testing uniqid() : error conditions ***\n"; 10 11echo "\n-- Testing uniqid() function with more than expected no. of arguments --\n"; 12$prefix = null; 13$more_entropy = false; 14$extra_arg = false; 15var_dump(uniqid($prefix, $more_entropy, $extra_arg)); 16 17echo "\n-- Testing uniqid() function with invalid values for \$prefix --\n"; 18class class1{} 19$obj = new class1(); 20$res = fopen(__FILE__, "r"); 21$array = array(1,2,3); 22 23uniqid($array, false); 24uniqid($res, false); 25uniqid($obj, false); 26 27fclose($res); 28 29?> 30===DONE=== 31--EXPECTF-- 32*** Testing uniqid() : error conditions *** 33 34-- Testing uniqid() function with more than expected no. of arguments -- 35 36Warning: uniqid() expects at most 2 parameters, 3 given in %s on line %d 37NULL 38 39-- Testing uniqid() function with invalid values for $prefix -- 40 41Warning: uniqid() expects parameter 1 to be string, array given in %s on line %d 42 43Warning: uniqid() expects parameter 1 to be string, resource given in %s on line %d 44 45Warning: uniqid() expects parameter 1 to be string, object given in %s on line %d 46===DONE=== 47