1--TEST--
2Bug #32647 (Using register_shutdown_function() with invalid callback can crash PHP)
3--FILE--
4<?php
5
6function foo()
7{
8  echo "foo!\n";
9}
10
11class bar
12{
13	function barfoo ()
14	{ echo "bar!\n"; }
15}
16
17unset($obj);
18register_shutdown_function(array($obj,""));            // Invalid
19register_shutdown_function(array($obj,"some string")); // Invalid
20register_shutdown_function(array(0,""));               // Invalid
21register_shutdown_function(array('bar','foo'));        // Invalid
22register_shutdown_function(array(0,"some string"));    // Invalid
23register_shutdown_function('bar');                     // Invalid
24register_shutdown_function('foo');                     // Valid
25register_shutdown_function(array('bar','barfoo'));     // Invalid
26
27$obj = new bar;
28register_shutdown_function(array($obj,'foobar'));      // Invalid
29register_shutdown_function(array($obj,'barfoo'));      // Valid
30
31?>
32--EXPECTF--
33Notice: Undefined variable: obj in %s on line %d
34
35Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
36
37Notice: Undefined variable: obj in %s on line %d
38
39Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
40
41Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
42
43Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foo' passed in %s on line %d
44
45Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
46
47Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d
48
49Deprecated: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d
50
51Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d
52foo!
53
54Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
55
56Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
57bar!
58bar!
59