We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ad6f7e6 commit f7b172aCopy full SHA for f7b172a
1 file changed
src/View.php
@@ -77,12 +77,16 @@ public function __construct(string $path = '')
77
*
78
* @throws Exception
79
*/
80
- public function setParam(string $key, mixed $value): static
+ public function setParam(string $key, mixed $value, bool $escapeHtml = true): static
81
{
82
if (\strpos($key, '.') !== false) {
83
throw new Exception('$key can\'t contain a dot "." character');
84
}
85
86
+ if (is_string($value) && $escapeHtml) {
87
+ $value = htmlspecialchars($value, encoding: 'UTF-8');
88
+ }
89
+
90
$this->params[$key] = $value;
91
92
return $this;
0 commit comments