Annotation of embedaddon/php/ext/standard/tests/file/fstat_variation6.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
1.1.1.2 ! misho 2: Test function fstat() by substituting argument 1 with object values.
1.1 misho 3: --FILE--
4: <?php
5:
6:
7:
8:
9: function 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: }
15: set_error_handler('test_error_handler');
16:
17:
18:
19: class classWithToString
20: {
21: public function __toString() {
22: return "Class A object";
23: }
24: }
25:
26: class classWithoutToString
27: {
28: }
29:
30: $variation_array = array(
31: 'instance of classWithToString' => new classWithToString(),
32: 'instance of classWithoutToString' => new classWithoutToString(),
33: );
34:
35:
36: foreach ( $variation_array as $var ) {
37: var_dump(fstat( $var ) );
38: }
39: ?>
40: ===DONE===
41: --EXPECTF--
42: Error: 2 - fstat() expects parameter 1 to be resource, object given, %s(%d)
43: bool(false)
44: Error: 2 - fstat() expects parameter 1 to be resource, object given, %s(%d)
45: bool(false)
46: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>