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
Describe the bug
The Parser fails to properly parse tags that have a similar name. It seems that the issue is on the regex on Parser::replaceSingle. Maybe it's to greedy and is just trying to replace also tags that are similarly prefixed. In my case I have two similar tags like:
{parser_test}
{parser_test_second}
So when it finds that {parser_test_second} it replaces it ignoring the _second part.
This can be verified with a simple experiment, if I change the order of the tags in the array that I pass to setData, the replacement is properly done, replacing first {parser_test_second} and then {parser_test}
One weird thing to notice, is that is not reproducible 100% of the times, being a few times where, other tags, are properly replaced.
CodeIgniter 4 version
4.0.4
Affected module(s)
Parser
Expected behavior, and steps to reproduce if appropriate
If I pass similar tags to the parser it won't properly parse them.
Describe the bug
The Parser fails to properly parse tags that have a similar name. It seems that the issue is on the regex on Parser::replaceSingle. Maybe it's to greedy and is just trying to replace also tags that are similarly prefixed. In my case I have two similar tags like:
{parser_test}
{parser_test_second}
So when it finds that {parser_test_second} it replaces it ignoring the _second part.
This can be verified with a simple experiment, if I change the order of the tags in the array that I pass to setData, the replacement is properly done, replacing first {parser_test_second} and then {parser_test}
One weird thing to notice, is that is not reproducible 100% of the times, being a few times where, other tags, are properly replaced.
CodeIgniter 4 version
4.0.4
Affected module(s)
Parser
Expected behavior, and steps to reproduce if appropriate
If I pass similar tags to the parser it won't properly parse them.
Situation
$this->parser = \Config\Services::parser();
$this->parser->setData(['parser_test' => 'parser test', 'parser_test_second' => 'parser test second'], 'raw')->render('index.html');
On my index.html I have
{parser_test}
{parser_test_second}
Actual behaviour
Both tags are replaced with
parser test
parser test
Expected behaviour
parser test
parser test second
Context
The text was updated successfully, but these errors were encountered: