From: Matthias Schmidt Date: Tue, 26 May 2020 14:39:45 +0000 (+0200) Subject: Improve error message in UserFunctionTemplatePlugin X-Git-Tag: 5.3.0_Alpha_1~253 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6796fc901f88267508256705132bc5d3e27197b0;p=GitHub%2FWoltLab%2FWCF.git Improve error message in UserFunctionTemplatePlugin See #3321 --- diff --git a/wcfsetup/install/files/lib/system/template/plugin/UserFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/UserFunctionTemplatePlugin.class.php index ad6d9ec58a..5b56dd2c52 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/UserFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/UserFunctionTemplatePlugin.class.php @@ -43,7 +43,12 @@ class UserFunctionTemplatePlugin implements IFunctionTemplatePlugin { $object = $tagArgs['object']; unset($tagArgs['object']); if (!($object instanceof UserProfile) && !ClassUtil::isDecoratedInstanceOf($object, UserProfile::class)) { - throw new \InvalidArgumentException("'object' attribute is no '" . UserProfile::class . "' object."); + $type = gettype($object); + if (is_object($object)) { + $type = "'" . get_class($object) . "' object"; + } + + throw new \InvalidArgumentException("'object' attribute is no '" . UserProfile::class . "' object, instead {$type} given."); } $additionalParameters = '';