You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| LightnCandy 1.2.6 | 5.2 ms | 2.8 ms | 8.0 ms | 5.3 MB |
13
-
| PHP Handlebars 1.2 | 3.7 ms | 1.5 ms |5.2 ms |3.6 MB |
13
+
| PHP Handlebars 1.2 | 3.3 ms | 1.5 ms |4.8 ms |1.9 MB |
14
14
15
15
_Tested on PHP 8.5 with the JIT enabled. See the `benchmark` branch to run the same test._
16
16
@@ -106,7 +106,7 @@ echo $template(['first' => 'John']); // Error: "last" not defined
106
106
`Handlebars::compile` returns a closure which can be invoked as `$template($context, $options)`.
107
107
The `$options` parameter takes an array of runtime options, accepting the following keys:
108
108
109
-
*`data`: An associative array of initial`@data` variables (e.g. `['version' => '1.0']` makes `@version` available in the template).
109
+
*`data`: An associative array of custom`@data` variables (e.g. `['version' => '1.0']` makes `@version` available in the template).
110
110
111
111
*`helpers`: An `array<string, \Closure>` of helpers to merge with the built-in helpers. Can also be used to override a built-in helper by using the same name.
112
112
@@ -218,8 +218,8 @@ If a custom helper is executed in a `{{ }}` expression, the return value will be
218
218
When a helper is executed in a `{{{ }}}` expression, the original return value will be output directly.
219
219
220
220
Helpers may return a `DevTheorem\Handlebars\SafeString` instance to prevent escaping the return value.
221
-
When constructing the string that will be marked as safe, any external content should be properly escaped
222
-
using the `Handlebars::escapeExpression()`method to avoid potential security concerns.
221
+
Because `SafeString` bypasses the automatic HTML escaping that `{{ }}` applies, any user-supplied content
222
+
embedded in it must first be escaped with `Handlebars::escapeExpression()` to prevent XSS vulnerabilities.
0 commit comments