-
Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathbug32647.phpt
87 lines (71 loc) · 2.52 KB
/
bug32647.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
--TEST--
Bug #32647 (Using register_shutdown_function() with invalid callback can crash PHP)
--FILE--
<?php
function foo()
{
echo "foo!\n";
}
class bar
{
function barfoo ()
{ echo "bar!\n"; }
}
unset($obj);
try {
register_shutdown_function(array($obj,""));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
register_shutdown_function(array($obj,"some string"));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
register_shutdown_function(array(0,""));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
register_shutdown_function(array('bar','foo'));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
register_shutdown_function(array(0,"some string"));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
register_shutdown_function('bar');
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
register_shutdown_function('foo');
try {
register_shutdown_function(array('bar','barfoo'));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
$obj = new bar;
try {
register_shutdown_function(array($obj,'foobar'));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
register_shutdown_function(array($obj,'barfoo'));
?>
--EXPECTF--
Warning: Undefined variable $obj in %s on line %d
register_shutdown_function(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
Warning: Undefined variable $obj in %s on line %d
register_shutdown_function(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
register_shutdown_function(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
register_shutdown_function(): Argument #1 ($callback) must be a valid callback, class bar does not have a method "foo"
register_shutdown_function(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
register_shutdown_function(): Argument #1 ($callback) must be a valid callback, function "bar" not found or invalid function name
register_shutdown_function(): Argument #1 ($callback) must be a valid callback, non-static method bar::barfoo() cannot be called statically
register_shutdown_function(): Argument #1 ($callback) must be a valid callback, class bar does not have a method "foobar"
foo!
bar!