1--TEST-- 2Test function readgzfile() by substituting argument 1 with object values. 3--SKIPIF-- 4<?php 5if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build'); 6?> 7--FILE-- 8<?php 9 10 11$use_include_path = false; 12 13 14function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { 15 if (error_reporting() != 0) { 16 // report non-silenced errors 17 echo "Error: $err_no - $err_msg, $filename($linenum)\n"; 18 } 19} 20set_error_handler('test_error_handler'); 21 22 23 24class classWithToString 25{ 26 public function __toString() { 27 return "Class A object"; 28 } 29} 30 31class classWithoutToString 32{ 33} 34 35$variation = array( 36 'instance of classWithToString' => new classWithToString(), 37 'instance of classWithoutToString' => new classWithoutToString(), 38 ); 39 40 41foreach ( $variation as $var ) { 42 var_dump(readgzfile( $var , $use_include_path ) ); 43} 44?> 45--EXPECTF-- 46Error: 2 - readgzfile(Class A object): failed to open stream: No such file or directory, %s(%d) 47bool(false) 48Error: 2 - readgzfile() expects parameter 1 to be a valid path, object given, %s(%d) 49NULL 50