Dan
Well-known member
This code
will throw always
Invalid user alert handler '' specified
if the class doesn't exist, resolveDynamicClass will return false and $class gets overwritten with false and won't contain the classname anymore.
I would suggest to replace it with
because this way we'll get the classname which caused this problem instead of the empty string ''
PHP:
public static function create($class)
{
$class = XenForo_Application::resolveDynamicClass($class);
if (XenForo_Application::autoload($class))
{
$obj = new $class();
if ($obj instanceof XenForo_AlertHandler_Abstract)
{
return $obj;
}
}
throw new XenForo_Exception("Invalid user alert handler '$class' specified");
}
Invalid user alert handler '' specified
if the class doesn't exist, resolveDynamicClass will return false and $class gets overwritten with false and won't contain the classname anymore.
I would suggest to replace it with
PHP:
public static function create($class)
{
$classResolved = XenForo_Application::resolveDynamicClass($class);
if (XenForo_Application::autoload($classResolved ))
{
$obj = new $classResolved ();
if ($obj instanceof XenForo_AlertHandler_Abstract)
{
return $obj;
}
}
throw new XenForo_Exception("Invalid user alert handler '$class' specified");
}
Last edited by a moderator:
Upvote
1