2012-01-10, 07:55 AM
Hi all,
if I use the add_shutdown() function (located in inc/functions.php) with a class name and a static method (both given as strings) the add_shutdown()-function raises an exception because it uses the PHP get_class()-function inside which allows only objects as first parameter since PHP version 5.3.x (I'm using 5.3.5).
A possible solution would be to add an is_string()-call in line 121 of "inc/functions.php" (MyBB version 1.6.5) in add_shutdown()-method:
Thanks in advance for some feedback,
Stephan Schulze (Germany)
if I use the add_shutdown() function (located in inc/functions.php) with a class name and a static method (both given as strings) the add_shutdown()-function raises an exception because it uses the PHP get_class()-function inside which allows only objects as first parameter since PHP version 5.3.x (I'm using 5.3.5).
class foo
{
public function someMethod()
{
}
public static function someStaticMethod()
{
}
}
$fooInstance = new foo();
// Works fine
add_shutdown($fooInstance, 'someMethod');
// Works fine with PHP 5.2.x but not with PHP 5.3.x
add_shutdown('foo', 'someStaticMethod');
A possible solution would be to add an is_string()-call in line 121 of "inc/functions.php" (MyBB version 1.6.5) in add_shutdown()-method:
$shutdown_functions["class_".(is_string($name[0]) ? $name[0] : get_class($name[0]))."_".$name[1]] = array('function' => $name, 'arguments' => $arguments);
Thanks in advance for some feedback,
Stephan Schulze (Germany)