File: bug32647.phpt

package info (click to toggle)
php5 5.6.33%2Bdfsg-0%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 157,872 kB
  • sloc: ansic: 756,065; php: 22,030; sh: 12,311; cpp: 8,771; xml: 6,179; yacc: 1,564; exp: 1,514; makefile: 1,467; pascal: 1,147; awk: 538; perl: 315; sql: 22
file content (61 lines) | stat: -rw-r--r-- 2,088 bytes parent folder | download | duplicates (6)
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
--TEST--
Bug #32647 (Using register_shutdown_function() with invalid callback can crash PHP)
--INI--
error_reporting=4095
display_errors=1
--FILE--
<?php

function foo()
{
  echo "foo!\n";
}

class bar
{
	function barfoo ()
	{ echo "bar!\n"; }
}

unset($obj);
register_shutdown_function(array($obj,""));            // Invalid
register_shutdown_function(array($obj,"some string")); // Invalid
register_shutdown_function(array(0,""));               // Invalid
register_shutdown_function(array('bar','foo'));        // Invalid
register_shutdown_function(array(0,"some string"));    // Invalid
register_shutdown_function('bar');                     // Invalid
register_shutdown_function('foo');                     // Valid
register_shutdown_function(array('bar','barfoo'));     // Invalid

$obj = new bar;
register_shutdown_function(array($obj,'foobar'));      // Invalid
register_shutdown_function(array($obj,'barfoo'));      // Valid

?>
--EXPECTF--
Notice: Undefined variable: obj in %s on line %d

Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d

Notice: Undefined variable: obj in %s on line %d

Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d

Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d

Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foo' passed in %s on line %d

Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d

Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d

Strict Standards: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d

Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d
foo!

Strict Standards: Non-static method bar::barfoo() should not be called statically in Unknown on line 0

Strict Standards: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
bar!
bar!