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

Don't recognize object method as filesystem func #20

Merged
merged 1 commit into from
Dec 13, 2018
Merged

Don't recognize object method as filesystem func #20

merged 1 commit into from
Dec 13, 2018

Conversation

bug-tape
Copy link
Contributor

@bug-tape bug-tape commented Aug 6, 2018

If you have a class with a method e.g. delete this sniff will give a warning when used with dynamic parameter. As long as only global functions must be checked this makes no sense.

If you have a class with a method e.g. *delete* this sniff will give a warning when used with dynamic parameter. As long as only global functions must be checked this makes no sense.
@jmarcil
Copy link
Collaborator

jmarcil commented Dec 13, 2018

Congratulations, you have found a false positive bug that goes way beyond your proposed fix!

For instance, what happens if you name your class method encrypt ? You'll get a warning. Actually this is the case for anything that is return by any $utils::get*Functions() , so it goes beyond FilesystemFunctionsSniff.

And here's the other use case not covered: ::. You could have a method call to your class with that such as $a::delete($a); and in this case get the same false positive.

I'll merge and fix.

Also, this skip will require ParanoiaMode off as it to remove a false positive.

In the future I think this is relevant enough so that we could patch other sniffers as well (like my encrypt example above).

Thanks!

@jmarcil jmarcil merged commit e54db42 into FloeDesignTechnologies:master Dec 13, 2018
@bug-tape
Copy link
Contributor Author

You're absolutely right. I only fixed the case that was bugging me.
Thanks for merging.

@igoooor
Copy link

igoooor commented Dec 1, 2020

Sorry to come back 2 years later, I'm only discovering this tool now.
I am facing the same issue with a custom class having a delete method and resulting in WARNING | Filesystem function delete() detected with dynamic parameter
According to this merged PR, this should not happen right?
Am I missing something?

I am using the latest version and running the following command:

phpcs --runtime-set ParanoiaMode 0 --ignore=Kernel.php --standard=Security ./

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants