-
Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy path010.phpt
99 lines (83 loc) · 2.21 KB
/
010.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
--TEST--
get_parent_class() tests
--FILE--
<?php
interface i {
function test();
}
class foo implements i {
function test() {
var_dump(get_parent_class());
}
}
class bar extends foo {
function test_bar() {
var_dump(get_parent_class($this));
}
}
$bar = new bar;
$foo = new foo;
set_error_handler(function ($severity, $message, $file, $line) {
throw new Exception($message);
});
try {
$foo->test();
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
set_error_handler(null);
$foo->test();
$bar->test();
$bar->test_bar();
var_dump(get_parent_class($bar));
var_dump(get_parent_class($foo));
var_dump(get_parent_class("bar"));
var_dump(get_parent_class("foo"));
var_dump(get_parent_class("i"));
try {
get_parent_class("");
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
get_parent_class("[[[[");
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
get_parent_class(" ");
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
var_dump(get_parent_class(new stdclass));
try {
get_parent_class(array());
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
get_parent_class(1);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
echo "Done\n";
?>
--EXPECTF--
Calling get_parent_class() without arguments is deprecated
Deprecated: Calling get_parent_class() without arguments is deprecated in %s on line %d
bool(false)
Deprecated: Calling get_parent_class() without arguments is deprecated in %s on line %d
bool(false)
string(3) "foo"
string(3) "foo"
bool(false)
string(3) "foo"
bool(false)
bool(false)
get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
bool(false)
get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given
get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given
Done