Possible false positives on rule Web:UnclosedTagCheck

Hello,

I think the following issue on a regex in a .php file is a false positive :

$pattern = ‘@(<a\[^>\]+?href=“(\[^”\]*)"\[^>\]*?>(.+?))@i’;

I think the following issue in a .twig template file is also a false positive :

Also, the error message itself is incorrect. The first error message above says:

The tag “a\[^” has no corresponding closing tag

when it should say something like:

The tag “<a>” has no corresponding closing tag

I am using SonarQube Community v26.1.0.118079.

1 Like

Hi @ivandalbosco,

Thank you for the report. Based on your feedback we have implemented 2 improvements:

With the next release of SonarQube both of these should be gracefully handled.

Kind regards,

Michal

Thank you very much Michal for your quick response.