phpinspectionsea
phpinspectionsea copied to clipboard
Request for Change; inspections regarding mkdir are incorrect (in my opinion)
Hi.
First of; this plugin is amazing! Really helpful tips, however, regarding mkdir, the suggestion is weird to say the least, or perhaps even wrong.
example;
when using mkdir( $some_folder )
, the suggestion is to use ! mkdir( $some_folder ) && ! is_dir( $some_folder )
This, however, creates the situation where PHP complaints;
PHP Warning: mkdir(): File exists in /some/script.php
To solve this, an ! is_dir()
is needed around the construction. but; is_dir
is already in there ...
I would suggest the suggestion be changed to
! is_dir( $some_folder ) && ! mkdir( $some_folder )
This way, a check is done before attempting the creation of the folder and everyone is happy :)
Thanks for reading/listening :)
Remon.
Couldn't agree more! Any progress on this?
Seems like the problem is located in the MkdirRaceConditionInspector.java file.
I'll try to make a pull-request for it, perhaps that is the preferred method??? (don't have a lot of experience in java, though, but I'll do my best)