1--TEST--
2Test function fstat() by substituting argument 1 with object values.
3--FILE--
4<?php
5
6
7
8
9function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
10        if (error_reporting() != 0) {
11                // report non-silenced errors
12                echo "Error: $err_no - $err_msg, $filename($linenum)\n";
13        }
14}
15set_error_handler('test_error_handler');
16
17
18
19class classWithToString
20{
21        public function __toString() {
22                return "Class A object";
23        }
24}
25
26class classWithoutToString
27{
28}
29
30$variation_array = array(
31  'instance of classWithToString' => new classWithToString(),
32  'instance of classWithoutToString' => new classWithoutToString(),
33  );
34
35
36foreach ( $variation_array as $var ) {
37  var_dump(fstat( $var  ) );
38}
39?>
40===DONE===
41--EXPECTF--
42Error: 2 - fstat() expects parameter 1 to be resource, object given, %s(%d)
43bool(false)
44Error: 2 - fstat() expects parameter 1 to be resource, object given, %s(%d)
45bool(false)
46===DONE===