18f9ec423SDave Kelsey--TEST--
204145dc2SVeres LajosTest function gzfile() by substituting argument 2 with object values.
38f9ec423SDave Kelsey--SKIPIF--
48f9ec423SDave Kelsey<?php
58f9ec423SDave Kelseyif (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
68f9ec423SDave Kelsey?>
78f9ec423SDave Kelsey--FILE--
88f9ec423SDave Kelsey<?php
98f9ec423SDave Kelsey
108f9ec423SDave Kelsey
118f9ec423SDave Kelsey$filename = $filename = dirname(__FILE__)."/004.txt.gz";
128f9ec423SDave Kelsey
138f9ec423SDave Kelsey
148f9ec423SDave Kelseyfunction test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
158f9ec423SDave Kelsey        if (error_reporting() != 0) {
168f9ec423SDave Kelsey                // report non-silenced errors
178f9ec423SDave Kelsey                echo "Error: $err_no - $err_msg, $filename($linenum)\n";
188f9ec423SDave Kelsey        }
198f9ec423SDave Kelsey}
208f9ec423SDave Kelseyset_error_handler('test_error_handler');
218f9ec423SDave Kelsey
228f9ec423SDave Kelsey
238f9ec423SDave Kelsey
248f9ec423SDave Kelseyclass classWithToString
258f9ec423SDave Kelsey{
268f9ec423SDave Kelsey        public function __toString() {
278f9ec423SDave Kelsey                return "Class A object";
288f9ec423SDave Kelsey        }
298f9ec423SDave Kelsey}
308f9ec423SDave Kelsey
318f9ec423SDave Kelseyclass classWithoutToString
328f9ec423SDave Kelsey{
338f9ec423SDave Kelsey}
348f9ec423SDave Kelsey
358f9ec423SDave Kelsey$variation = array(
368f9ec423SDave Kelsey  'instance of classWithToString' => new classWithToString(),
378f9ec423SDave Kelsey  'instance of classWithoutToString' => new classWithoutToString(),
388f9ec423SDave Kelsey  );
398f9ec423SDave Kelsey
408f9ec423SDave Kelsey
418f9ec423SDave Kelseyforeach ( $variation as $var ) {
428f9ec423SDave Kelsey  var_dump(gzfile( $filename, $var  ) );
438f9ec423SDave Kelsey}
448f9ec423SDave Kelsey?>
458f9ec423SDave Kelsey===DONE===
468f9ec423SDave Kelsey--EXPECTF--
47ce1d69a1SGabriel CarusoError: 2 - gzfile() expects parameter 2 to be int, object given, %s(%d)
488f9ec423SDave KelseyNULL
49ce1d69a1SGabriel CarusoError: 2 - gzfile() expects parameter 2 to be int, object given, %s(%d)
508f9ec423SDave KelseyNULL
51b746e698SPeter Kokot===DONE===
52