summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJack Dane <jackd98.jd@gmail.com>2023-10-22 22:49:46 +0100
committerGitHub <noreply@github.com>2023-10-22 23:49:46 +0200
commit212bf88eb23791edcb9ab662ea438743b40f5943 (patch)
treec20179a78fed22e1c85ec31fa20ea133ad8b4641 /src
parent26332c9de4b8341e3de0cb198706a6573e54dfe7 (diff)
downloadsmarty-212bf88eb23791edcb9ab662ea438743b40f5943.tar.gz
smarty-212bf88eb23791edcb9ab662ea438743b40f5943.tar.bz2
smarty-212bf88eb23791edcb9ab662ea438743b40f5943.zip
Fix case-sensitive tag names (#907) (#910)
* Don't lower tags until they are used for extensions so custom tags can be case-sensitive.
Diffstat (limited to 'src')
-rw-r--r--src/Compiler/Template.php5
-rw-r--r--src/Security.php2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/Compiler/Template.php b/src/Compiler/Template.php
index 03ee5110..e584236a 100644
--- a/src/Compiler/Template.php
+++ b/src/Compiler/Template.php
@@ -464,7 +464,7 @@ class Template extends BaseCompiler {
public function compileTag($tag, $args, $parameter = []) {
$this->prefixCodeStack[] = $this->prefix_code;
$this->prefix_code = [];
- $result = $this->compileTag2(strtolower($tag), $args, $parameter);
+ $result = $this->compileTag2($tag, $args, $parameter);
$this->prefix_code = array_merge($this->prefix_code, array_pop($this->prefixCodeStack));
return $result;
}
@@ -591,6 +591,7 @@ class Template extends BaseCompiler {
* @return ?\Smarty\Compile\CompilerInterface tag compiler object or null if not found or untrusted by security policy
*/
public function getTagCompiler($tag): ?\Smarty\Compile\CompilerInterface {
+ $tag = strtolower($tag);
if (isset($this->smarty->security_policy) && !$this->smarty->security_policy->isTrustedTag($tag, $this)) {
return null;
@@ -1114,7 +1115,7 @@ class Template extends BaseCompiler {
}
}
- // call to function previousely defined by {function} tag
+ // call to function previously defined by {function} tag
if ($this->canCompileTemplateFunctionCall($tag)) {
if (!empty($parameter['modifierlist'])) {
diff --git a/src/Security.php b/src/Security.php
index 46cddcee..2f654d4e 100644
--- a/src/Security.php
+++ b/src/Security.php
@@ -261,6 +261,8 @@ class Security {
* @return boolean true if tag is trusted
*/
public function isTrustedTag($tag_name, $compiler) {
+ $tag_name = strtolower($tag_name);
+
// check for internal always required tags
if (in_array($tag_name, ['assign', 'call'])) {
return true;