1--TEST-- 2Test function gzfile() by substituting agument 2 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$filename = $filename = dirname(__FILE__)."/004.txt.gz"; 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(gzfile( $filename, $var ) ); 43} 44?> 45===DONE=== 46--EXPECTF-- 47Error: 2 - gzfile() expects parameter 2 to be long, object given, %s(%d) 48NULL 49Error: 2 - gzfile() expects parameter 2 to be long, object given, %s(%d) 50NULL 51===DONE===