blob: 0dfafa6229518f735585ad443697d2231788c0ab (
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
38
|
--TEST--
Test function getservbyname() by substituting argument 1 with object values.
--FILE--
<?php
echo "*** Test substituting argument 1 with object values ***\n";
$protocol = "tcp";
class classWithToString
{
public function __toString() {
return "Class A object";
}
}
class classWithoutToString
{
}
$variation_array = array(
'instance of classWithToString' => new classWithToString(),
'instance of classWithoutToString' => new classWithoutToString(),
);
foreach ( $variation_array as $var ) {
var_dump(getservbyname( $var , $protocol ) );
}
?>
--EXPECTF--
*** Test substituting argument 1 with object values ***
bool(false)
Warning: getservbyname() expects parameter 1 to be string, object given in %s.php on line %d
NULL
|