From 597f120ca832d1a865282e2ea50085444e1d4814 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 7 Jan 2019 19:05:34 +0100 Subject: [PATCH] Detect uses of Language::get() instead of Language::getDynamicVariable() Close #2787 --- wcfsetup/install/files/lib/data/language/Language.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wcfsetup/install/files/lib/data/language/Language.class.php b/wcfsetup/install/files/lib/data/language/Language.class.php index b0c4a4c306..d2f42c1e7b 100644 --- a/wcfsetup/install/files/lib/data/language/Language.class.php +++ b/wcfsetup/install/files/lib/data/language/Language.class.php @@ -80,6 +80,10 @@ class Language extends DatabaseObject { * @return string */ public function get($item, $optional = false) { + if (ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS && is_array($optional) && !empty($optional)) { + throw new \InvalidArgumentException("The second parameter of Language::get() does not support non-empty arrays. Did you mean to use Language::getDynamicVariable()?"); + } + if (!isset($this->items[$item])) { // load category file $explodedItem = explode('.', $item); -- 2.20.1