From 6796fc901f88267508256705132bc5d3e27197b0 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Tue, 26 May 2020 16:39:45 +0200 Subject: [PATCH] Improve error message in UserFunctionTemplatePlugin See #3321 --- .../template/plugin/UserFunctionTemplatePlugin.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 = ''; -- 2.20.1