Detect uses of Language::get() instead of Language::getDynamicVariable()
authorMatthias Schmidt <gravatronics@live.com>
Mon, 7 Jan 2019 18:05:34 +0000 (19:05 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 7 Jan 2019 18:05:34 +0000 (19:05 +0100)
Close #2787

wcfsetup/install/files/lib/data/language/Language.class.php

index b0c4a4c3065d1a2f4979ff3adc2aba4e94c40686..d2f42c1e7b7109e0ce3651e97a71b2acea46200a 100644 (file)
@@ -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);