14ce8a478SDave Kelsey--TEST--
204145dc2SVeres LajosTest function fstat() by substituting argument 1 with object values.
34ce8a478SDave Kelsey--FILE--
44ce8a478SDave Kelsey<?php
54ce8a478SDave Kelsey
64ce8a478SDave Kelsey
74ce8a478SDave Kelsey
84ce8a478SDave Kelsey
94ce8a478SDave Kelseyfunction test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
104ce8a478SDave Kelsey        if (error_reporting() != 0) {
114ce8a478SDave Kelsey                // report non-silenced errors
124ce8a478SDave Kelsey                echo "Error: $err_no - $err_msg, $filename($linenum)\n";
134ce8a478SDave Kelsey        }
144ce8a478SDave Kelsey}
154ce8a478SDave Kelseyset_error_handler('test_error_handler');
164ce8a478SDave Kelsey
174ce8a478SDave Kelsey
184ce8a478SDave Kelsey
194ce8a478SDave Kelseyclass classWithToString
204ce8a478SDave Kelsey{
214ce8a478SDave Kelsey        public function __toString() {
224ce8a478SDave Kelsey                return "Class A object";
234ce8a478SDave Kelsey        }
244ce8a478SDave Kelsey}
254ce8a478SDave Kelsey
264ce8a478SDave Kelseyclass classWithoutToString
274ce8a478SDave Kelsey{
284ce8a478SDave Kelsey}
294ce8a478SDave Kelsey
304ce8a478SDave Kelsey$variation_array = array(
314ce8a478SDave Kelsey  'instance of classWithToString' => new classWithToString(),
324ce8a478SDave Kelsey  'instance of classWithoutToString' => new classWithoutToString(),
334ce8a478SDave Kelsey  );
344ce8a478SDave Kelsey
354ce8a478SDave Kelsey
364ce8a478SDave Kelseyforeach ( $variation_array as $var ) {
374ce8a478SDave Kelsey  var_dump(fstat( $var  ) );
384ce8a478SDave Kelsey}
394ce8a478SDave Kelsey?>
404ce8a478SDave Kelsey===DONE===
414ce8a478SDave Kelsey--EXPECTF--
424ce8a478SDave KelseyError: 2 - fstat() expects parameter 1 to be resource, object given, %s(%d)
434ce8a478SDave Kelseybool(false)
444ce8a478SDave KelseyError: 2 - fstat() expects parameter 1 to be resource, object given, %s(%d)
454ce8a478SDave Kelseybool(false)
46b746e698SPeter Kokot===DONE===