php-src/ext/standard/tests/general_functions/bug32647.phpt

62 lines
2.0 KiB
Plaintext
Raw Normal View History

2005-04-21 14:17:52 +00:00
--TEST--
Bug #32647 (Using register_shutdown_function() with invalid callback can crash PHP)
--INI--
2005-12-16 22:19:02 +00:00
error_reporting=4095
2005-04-21 14:17:52 +00:00
display_errors=1
--FILE--
<?php
function foo()
{
2005-12-16 22:19:02 +00:00
echo "foo!\n";
2005-04-21 14:17:52 +00:00
}
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
2005-12-16 22:19:02 +00:00
register_shutdown_function('bar'); // Invalid
2005-04-21 14:17:52 +00:00
register_shutdown_function('foo'); // Valid
2005-12-16 22:19:02 +00:00
register_shutdown_function(array('bar','barfoo')); // Invalid
2005-04-21 14:17:52 +00:00
$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
2007-09-14 15:04:19 +00:00
Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foo' passed in %s on line %d
2005-04-21 14:17:52 +00:00
Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
2007-09-14 15:04:19 +00:00
Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d
2008-02-02 00:29:17 +00:00
Strict Standards: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d
2005-04-21 14:17:52 +00:00
2005-12-16 22:19:02 +00:00
Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d
foo!
2008-02-02 00:29:17 +00:00
Strict Standards: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
2005-04-21 14:17:52 +00:00
2008-02-02 00:29:17 +00:00
Strict Standards: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
2005-12-16 22:19:02 +00:00
bar!
2005-04-21 14:17:52 +00:00
bar!