summaryrefslogtreecommitdiff
path: root/ext/standard/tests/math/bindec_error.phpt
blob: a6b96185c14e30a3ead2880b7f736af8ee080c49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--TEST--
Test bindec() function :  error conditions - incorrect input
--FILE--
<?php
/* Prototype  : number bindec  ( string $binary_string  )
 * Description: Returns the decimal equivalent of the binary number represented by the binary_string  argument.
 * Source code: ext/standard/math.c
 */

/*
 * Pass incorrect input to bindec() to test behaviour
 */

echo "*** Testing bindec() : error conditions ***\n";

// get a class
class classA
{
}

echo "Incorrect number of arguments\n";
bindec();
bindec('01010101111',true);

echo "Incorrect input\n";
bindec(new classA());
?>
--EXPECTF--
*** Testing bindec() : error conditions ***
Incorrect number of arguments

Warning: bindec() expects exactly 1 parameter, 0 given in %s on line %d

Warning: bindec() expects exactly 1 parameter, 2 given in %s on line %d
Incorrect input

Recoverable fatal error: Object of class classA could not be converted to string in %s on line %d