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