psalm-plugin-symfony icon indicating copy to clipboard operation
psalm-plugin-symfony copied to clipboard

Template variables with an underscore lead to errors in taint analysis

Open binarious opened this issue 4 years ago • 1 comments

The check in AnalyzedTemplatesTainter for Twig variables just checks for ([a-zA-Z]+) while Twig variables could contain other characters (like _). Having a variable named my_result leads to:

Uncaught Exception: Argument 2 passed to Psalm\SymfonyPsalmPlugin\Twig\TemplateFileAnalyzer::getTaintNodeForTwigNamedVariable() must be of the type string, null given, called in /Users/myuser/projects/myapp/vendor/psalm/plugin-symfony/src/Twig/AnalyzedTemplatesTainter.php on line 45

binarious avatar Jan 29 '21 10:01 binarious

@binarious thank you for the report

seferov avatar Feb 11 '21 06:02 seferov