psalm / psalm-plugin-symfony

Psalm Plugin for Symfony
MIT License
226 stars 53 forks source link

Template variables with an underscore lead to errors in taint analysis #139

Open binarious opened 3 years ago

binarious commented 3 years ago

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
seferov commented 3 years ago

@binarious thank you for the report