handlebars-php icon indicating copy to clipboard operation
handlebars-php copied to clipboard

rendering with strict=true does not throw for missing nested variables in context

Open hubermat opened this issue 2 years ago • 0 comments

When I have the following nested context:

[
  'person' => [
    'firstName' => 'Foo',
    'lastName' => 'Bar',
    'zip' => '12345'
  ]
]

and want to get variables from this context with strict checking (should throw an exception, if the variable does not exist), it throws an exception correctly for $context->get('bogusvariable', true), but not for $context->get('person.city', true). From looking at the code, I found out that for nested variables the check for $strict is missing in Context::findVariableInContext.

Linked pull request fixes this issue.

hubermat avatar Oct 06 '23 15:10 hubermat