smarty-php / smarty-php/smarty

Incorrect error displayed when there is an error inside of a capture block

Open
#1,102 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
2.3k
Forks
709
PR merge metrics
No merged PRs in 30d

Description

When you have an error inside a {capture} block, smarty will incorrectly report that there is a syntax error
"Not matching {capture}{/capture} "

Here is an example of code that would produce this error:

<?php
use Smarty\Smarty;
$smarty = new Smarty();
$template = '{$nullVariable = null} {capture} stuff to capture {$nullVariable->someFunction()} {/capture}';
$smarty->display('eval:'.$template);
?>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the PHP reproduction from the issue and tracing how errors inside a {capture} block are reported. Inspect the capture parsing and error-handling paths; done means the underlying template error is reported accurately rather than as an unmatched {capture} pair.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.