Skip to content

Commit fc143fc

Browse files
committed
Release 1.2.2
1 parent 70b1d3d commit fc143fc

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
55

6+
## [1.2.2] Faithful Dispatch - 2026-04-05
7+
8+
### Changed
9+
- Better aligned compiler and runtime structure with Handlebars.js,
10+
fixing numerous edge cases related to helpers and `@data` variables.
11+
12+
### Fixed
13+
- `../` expressions inside `{{else}}` blocks of `{{#if}}`, `{{#unless}}`, `{{#with}}`, and sections invoking `blockHelperMissing` resolved to the wrong context level.
14+
- A missing helper called via multi-segment path in a subexpression or `@data` variable failed to invoke `helperMissing`.
15+
- A non-function context property used as a helper (e.g. `{{foo "arg"}}` where `foo` is not a closure) incorrectly called `helperMissing` rather than throwing a distinct error.
16+
- No error thrown when calling a missing helper via a multi-segment path with arguments (e.g. `{{foo.bar "arg"}}`).
17+
- Closures in context data could not be used as block helpers (e.g. `{{#fn}}...{{/fn}}` where `fn` is a closure).
18+
- Closures in context data or `@data` variables failed to be passed `HelperOptions` as the last argument in certain cases.
19+
- Templates with hash arguments on complex paths (e.g. `{{foo.bar arg=val}}`) were not compiled correctly.
20+
- Closures in context data were not invoked when accessed via a multi-segment path (e.g. `{{foo.bar}}`), or via a literal path (e.g. `{{"foo"}}`) in `knownHelpersOnly` mode.
21+
- `@data` variables incorrectly took priority over helpers with the same name.
22+
- `knownHelpersOnly` was not enforced for `@data` expressions or complex paths used with arguments.
23+
24+
625
## [1.2.1] Optimal Simplification - 2026-04-02
726

827
### Changed
@@ -216,6 +235,7 @@ Initial release after forking from LightnCandy 1.2.6.
216235
- HTML documentation.
217236
- Dozens of unnecessary feature flags.
218237

238+
[1.2.2]: https://github.com/devtheorem/php-handlebars/compare/v1.2.1...v1.2.2
219239
[1.2.1]: https://github.com/devtheorem/php-handlebars/compare/v1.2.0...v1.2.1
220240
[1.2.0]: https://github.com/devtheorem/php-handlebars/compare/v1.1.0...v1.2.0
221241
[1.1.0]: https://github.com/devtheorem/php-handlebars/compare/v1.0.1...v1.1.0

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PHP Handlebars compiles and executes complex templates up to 40% faster than Lig
1010
| Library | Compile time | Runtime | Total time | Peak memory usage |
1111
|--------------------|--------------|---------|------------|-------------------|
1212
| LightnCandy 1.2.6 | 5.2 ms | 2.8 ms | 8.0 ms | 5.3 MB |
13-
| PHP Handlebars 1.2 | 3.3 ms | 1.5 ms | 4.8 ms | 1.9 MB |
13+
| PHP Handlebars 1.2 | 3.2 ms | 1.5 ms | 4.7 ms | 1.9 MB |
1414

1515
_Tested on PHP 8.5 with the JIT enabled. See the `benchmark` branch to run the same test._
1616

@@ -162,10 +162,10 @@ echo $template(['my_var' => null], $runtimeOptions); // Not equal
162162

163163
* `fn(mixed $context = <current scope>, mixed $data = null): string`: Renders the block body.
164164
Pass a new context as `$context` to change what the block renders against (equivalent to `options.fn(newContext)` in JS).
165-
Pass a `$data` array with a `'data'` key to inject additional `@`-prefixed variables into the block,
165+
Pass a `$data` array with a `'data'` key to inject `@`-prefixed variables into the block,
166166
and/or a `'blockParams'` key containing an array of values to expose as block parameters.
167167

168-
* `inverse(mixed $context = null, mixed $data = null): string`: Renders the `{{else}}` / inverse block.
168+
* `inverse(mixed $context = <current scope>, mixed $data = null): string`: Renders the `{{else}}` / inverse block.
169169
Returns an empty string if no inverse block was provided.
170170
Accepts the same optional `$context` and `$data` arguments as `fn()`.
171171

0 commit comments

Comments
 (0)