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