Annotation of embedaddon/php/ext/standard/tests/math/bindec_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test bindec() function : error conditions - incorrect input
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : number bindec ( string $binary_string )
! 6: * Description: Returns the decimal equivalent of the binary number represented by the binary_string argument.
! 7: * Source code: ext/standard/math.c
! 8: */
! 9:
! 10: /*
! 11: * Pass incorrect input to bindec() to test behaviour
! 12: */
! 13:
! 14: echo "*** Testing bindec() : error conditions ***\n";
! 15:
! 16: // get a class
! 17: class classA
! 18: {
! 19: }
! 20:
! 21: echo "Incorrect number of arguments\n";
! 22: bindec();
! 23: bindec('01010101111',true);
! 24:
! 25: echo "Incorrect input\n";
! 26: bindec(new classA());
! 27: ?>
! 28: --EXPECTF--
! 29: *** Testing bindec() : error conditions ***
! 30: Incorrect number of arguments
! 31:
! 32: Warning: bindec() expects exactly 1 parameter, 0 given in %s on line %d
! 33:
! 34: Warning: bindec() expects exactly 1 parameter, 2 given in %s on line %d
! 35: Incorrect input
! 36:
! 37: Catchable fatal error: Object of class classA could not be converted to string in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>