Fix undefined constants breaking installation
authorMatthias Schmidt <gravatronics@live.com>
Thu, 10 Jan 2019 17:32:47 +0000 (18:32 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 10 Jan 2019 17:32:47 +0000 (18:32 +0100)
See #2787
Close #2828
See 597f120ca832d1a865282e2ea50085444e1d4814

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

index d2f42c1e7b7109e0ce3651e97a71b2acea46200a..d5f508a947a74a4539907f05e17387879dc3d0d3 100644 (file)
@@ -80,7 +80,14 @@ class Language extends DatabaseObject {
         * @return      string
         */
        public function get($item, $optional = false) {
-               if (ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS && is_array($optional) && !empty($optional)) {
+               if (
+                       defined('ENABLE_DEBUG_MODE') &&
+                       ENABLE_DEBUG_MODE &&
+                       defined('ENABLE_DEVELOPER_TOOLS') &&
+                       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()?");
                }
                
@@ -111,6 +118,7 @@ class Language extends DatabaseObject {
                if (
                        defined('ENABLE_DEVELOPER_TOOLS') &&
                        ENABLE_DEVELOPER_TOOLS &&
+                       defined('LOG_MISSING_LANGUAGE_ITEMS') &&
                        LOG_MISSING_LANGUAGE_ITEMS &&
                        preg_match('~^([a-zA-Z0-9-_]+\.)+[a-zA-Z0-9-_]+$~', $item)
                ) {
@@ -147,6 +155,7 @@ class Language extends DatabaseObject {
                if (
                        defined('ENABLE_DEVELOPER_TOOLS') &&
                        ENABLE_DEVELOPER_TOOLS &&
+                       defined('LOG_MISSING_LANGUAGE_ITEMS') &&
                        LOG_MISSING_LANGUAGE_ITEMS &&
                        $staticItem === $item &&
                        preg_match('~^([a-zA-Z0-9-_]+\.)+[a-zA-Z0-9-_]+$~', $item)