vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.54k stars 659 forks source link

Taint not found inside "if" statement #7950

Open mmcev106 opened 2 years ago

mmcev106 commented 2 years ago

Should this taint be reported?

https://psalm.dev/r/8c624220b8

psalm-github-bot[bot] commented 2 years ago

I found these snippets:

https://psalm.dev/r/8c624220b8 ```php
AndrolGenhald commented 2 years ago

Yes, but currently the type of $a is lost once the if scope ends. I have a branch I've done some work on to fix this, but I haven't had much time the past few months to finish it and get it working. Hopefully I'll have more time in a month or two, I'll add this as a test case to make sure it works.

mmcev106 commented 2 years ago

Thanks for the info! I'm curious, which branch would that be?

AndrolGenhald commented 2 years ago

I think it's still local atm, it's failing a lot of tests and still needs quite a bit of work. I started working on loops and ifs after I got stuck on the same issue in #7688, since the variable not being defined outside of the if scope caused problems with my TryAnalyzer improvements.

mmcev106 commented 1 year ago

@AndrolGenhald, any updates here? If not, would it make sense for that branch to be made public so that others might be able to help?

orklah commented 1 year ago

The branch is here if anyone want to look at it