Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FILTER_SANITIZE_* can return empty strings #5543

Closed
BackEndTea opened this issue Aug 27, 2021 · 4 comments
Closed

FILTER_SANITIZE_* can return empty strings #5543

BackEndTea opened this issue Aug 27, 2021 · 4 comments
Labels
Milestone

Comments

@BackEndTea
Copy link
Contributor

BackEndTea commented Aug 27, 2021

Bug report

PhpStan assumes that filter var will return a non empty string if it was fed one. This is not correct for the sanitize versions, as those strip invalid data, which may result in an empty string

Code snippet that reproduces the problem

https://3v4l.org/PXaQ7

https://phpstan.org/r/e5293908-1516-4ca5-bc29-4c6bd7ffbb4b

Expected output

@mergeable
Copy link

mergeable bot commented Aug 27, 2021

This bug report is missing a link to reproduction on phpstan.org.

It will most likely be closed after manual review.

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Aug 27, 2021
@phpstan-bot
Copy link
Contributor

@BackEndTea After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-2: Dumped type: non-empty-string|false
+2: Dumped type: string|false
Full report
Line Error
2 `Dumped type: string

@ondrejmirtes
Copy link
Member

Fixed by: phpstan/phpstan-src#650

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants