1--TEST--
2Test function getservbyname() by substituting argument 2 with object values.
3--FILE--
4<?php
5
6
7echo "*** Test substituting argument 2 with object values ***\n";
8
9$service = "www";
10
11
12class classWithToString
13{
14        public function __toString() {
15                return "Class A object";
16        }
17}
18
19class classWithoutToString
20{
21}
22
23$variation_array = array(
24  'instance of classWithToString' => new classWithToString(),
25  'instance of classWithoutToString' => new classWithoutToString(),
26  );
27
28
29foreach ( $variation_array as $var ) {
30  var_dump(getservbyname( $service, $var  ) );
31}
32?>
33--EXPECTF--
34*** Test substituting argument 2 with object values ***
35bool(false)
36
37Warning: getservbyname() expects parameter 2 to be string, object given in %s.php on line %d
38NULL
39