1--TEST-- 2Test unpack() function : error conditions 3--FILE-- 4<?php 5 6/* Prototype : array unpack ( string $format , string $data ) 7 * Description: Unpack data from binary string 8 * Source code: ext/standard/pack.c 9*/ 10 11echo "*** Testing unpack() : error conditions ***\n"; 12 13echo "\n-- Testing unpack() function with no arguments --\n"; 14var_dump( unpack() ); 15 16echo "\n-- Testing unpack() function with more than expected no. of arguments --\n"; 17$extra_arg = 10; 18var_dump(unpack("I", pack("I", 65534), $extra_arg)); 19 20echo "\n-- Testing unpack() function with invalid format character --\n"; 21$extra_arg = 10; 22var_dump(unpack("B", pack("I", 65534))); 23?> 24===DONE=== 25--EXPECTF-- 26*** Testing unpack() : error conditions *** 27 28-- Testing unpack() function with no arguments -- 29 30Warning: unpack() expects exactly 2 parameters, 0 given in %s on line %d 31NULL 32 33-- Testing unpack() function with more than expected no. of arguments -- 34 35Warning: unpack() expects exactly 2 parameters, 3 given in %s on line %d 36NULL 37 38-- Testing unpack() function with invalid format character -- 39 40Warning: unpack(): Invalid format type B in %s on line %d 41bool(false) 42===DONE=== 43