FriendsOfShopware / FroshProfiler

This plugin allows you to profile your Shopware 5 application
MIT License
159 stars 41 forks source link

BlockSplitter falsely recognizes commented out Smarty tags #124

Closed mjossdev closed 2 years ago

mjossdev commented 2 years ago

PHP Version

7.4

Shopware Version

5.7.4

Actual behaviour

The Regex used in the FroshProfiler\Components\BlockAnnotation\BlockSplitter class also recognizes {block} tags which are commented out. For example if {*{/block}*} is somewhere in a template the BlockSpliltter will incorrectly think that the current block is closed. Which causes one of the real block tags to be unmatched, which causes an exception on line 42 because $element['start'] or $element['end'] will be null. If Smarty has some APIs to access an Abstract Syntax Tree representation of the template or something similar, maybe this Regex issue could be avoided.

Expected behaviour

The BlockSplitter should ignore commented out template code.

Steps to Reproduce?

shyim commented 2 years ago

Please create a GitHub PR. We don't maintain SW5 anymore actively