Fixed variable passing for static includes
authorAlexander Ebert <ebert@woltlab.com>
Mon, 13 Feb 2012 13:34:27 +0000 (14:34 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 13 Feb 2012 13:34:27 +0000 (14:34 +0100)
Previously it was not possible to pass boolean values or numbers, because they were not recognized as valid value (even though they actually are).

wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php

index 41689e08611ac050b918848148fa74227b7e3994..aeb9cb42c18666ab776e633cbac733cf6b4fbe8f 100644 (file)
@@ -781,14 +781,17 @@ class TemplateScriptingCompiler {
                        if (!empty($args)) {
                                foreach ($args as $variable => $value) {
                                        if (substr($value, 0, 1) == "'") {
+                                               // string values
                                                $phpCode .= "\$this->v['".$variable."'] = ".$value.";\n";
                                        }
                                        else {
                                                if (preg_match('~^\$this->v\[\'(.*)\'\]$~U', $value, $matches)) {
+                                                       // value is a variable itself
                                                        $phpCode .= "\$this->v['".$variable."'] = ".$value.";\n";
                                                }
                                                else {
-                                                       throw new SystemException("Could not resolve variable type for value '".$value."'");
+                                                       // value is boolean, an integer or anything else
+                                                       $phpCode .= "\$this->v['".$variable."'] = ".$value.";\n";
                                                }
                                        }
                                }