Annotation of embedaddon/php/ext/standard/tests/strings/unpack_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test 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:
! 11: echo "*** Testing unpack() : error conditions ***\n";
! 12:
! 13: echo "\n-- Testing unpack() function with no arguments --\n";
! 14: var_dump( unpack() );
! 15:
! 16: echo "\n-- Testing unpack() function with more than expected no. of arguments --\n";
! 17: $extra_arg = 10;
! 18: var_dump(unpack("I", pack("I", 65534), $extra_arg));
! 19:
! 20: echo "\n-- Testing unpack() function with invalid format character --\n";
! 21: $extra_arg = 10;
! 22: var_dump(unpack("Z", pack("I", 65534)));
! 23: ?>
! 24: ===DONE===
! 25: --EXPECTF--
! 26: *** Testing unpack() : error conditions ***
! 27:
! 28: -- Testing unpack() function with no arguments --
! 29:
! 30: Warning: unpack() expects exactly 2 parameters, 0 given in %s on line %d
! 31: NULL
! 32:
! 33: -- Testing unpack() function with more than expected no. of arguments --
! 34:
! 35: Warning: unpack() expects exactly 2 parameters, 3 given in %s on line %d
! 36: NULL
! 37:
! 38: -- Testing unpack() function with invalid format character --
! 39:
! 40: Warning: unpack(): Invalid format type Z in %s on line %d
! 41: bool(false)
! 42: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>