From: Alexander Ebert Date: Tue, 23 Apr 2019 14:54:53 +0000 (+0200) Subject: Incorrect handling of non countable values passed to `{foreach}` X-Git-Tag: 5.2.0_Alpha_1~121 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aff836382b0b7574ecc06a5c9de22fde5536171f;p=GitHub%2FWoltLab%2FWCF.git Incorrect handling of non countable values passed to `{foreach}` See 745a19744bf6e00843b8f66f24b8b08d409c4149 --- diff --git a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php index 010ea46ebe..de430c50ec 100644 --- a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php @@ -695,7 +695,7 @@ class TemplateScriptingCompiler { $phpCode .= $foreachHash." = ".$args['from'].";\n"; if (empty($foreachProp)) { - $phpCode .= "if ((is_countable(".$foreachHash.") && count(".$foreachHash.") > 0) || ".$foreachHash.") {\n"; + $phpCode .= "if ((is_countable(".$foreachHash.") && count(".$foreachHash.") > 0) || (!is_countable(".$foreachHash.") && ".$foreachHash.")) {\n"; } else { $phpCode .= $foreachHash."_cnt = (".$foreachHash." !== null ? 1 : 0);\n";