diff --git a/CHANGELOG.md b/CHANGELOG.md index 39164d18a..e310311f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Smarty now always runs in multibyte mode, using `symfony/polyfill-mbstring` if required. Please use the multibyte extension for optimal performance. - Smarty no longer calls `mb_internal_encoding()` and doesn't check for deprecated `mbstring.func_overload` ini directive [#480](https://github.com/smarty-php/smarty/issues/480) +- Generated ` @@ -47,7 +47,7 @@ spiders to lift email addresses off of a site. me@example.com {mailto address="me@example.com" encode="javascript_charcode"} - diff --git a/src/FunctionHandler/Mailto.php b/src/FunctionHandler/Mailto.php index 5e5337ea0..8f7b821a5 100644 --- a/src/FunctionHandler/Mailto.php +++ b/src/FunctionHandler/Mailto.php @@ -109,12 +109,12 @@ public function handle($params, Template $template) { for ($x = 0, $_length = strlen($string); $x < $_length; $x++) { $js_encode .= '%' . bin2hex($string[$x]); } - return ''; + return ''; } elseif ($encode === 'javascript_charcode') { for ($x = 0, $_length = strlen($string); $x < $_length; $x++) { $ord[] = ord($string[$x]); } - return ''; + return ''; } elseif ($encode === 'hex') { preg_match('!^(.*)(\?.*)$!', $address, $match); if (!empty($match[2])) { diff --git a/src/debug.tpl b/src/debug.tpl index 4f82a5820..64add8643 100644 --- a/src/debug.tpl +++ b/src/debug.tpl @@ -166,7 +166,7 @@ {/capture} -'; + $result = ''; $tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" encode="javascript"}'); $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl)); } public function testEncodeJavascriptCharcode() { - $result = ''; + $result = ''; $tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" encode="javascript_charcode"}'); $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl)); } @@ -85,7 +85,7 @@ public function testUmlauts() public function testJavascriptChars() { - $result = ''; + $result = ''; $this->smarty->assign('address', 'me@example.com">me@example.com\'); alert("injection"); //'); $tpl = $this->smarty->createTemplate('eval:{mailto address=$address encode=javascript}'); $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));