Giter Site home page Giter Site logo

Comments (5)

kalessil avatar kalessil commented on May 21, 2024

Thanks for reporting, @marcelloh .

False-positive is confirmed, I will ping you when it fixed.

from phpinspectionsea.

dryabov avatar dryabov commented on May 21, 2024

@kalessil I have false-positive for following code:

    public function makeDir($path, $chmod = 0777)
    {
        return is_dir($path) || @mkdir($path, $chmod, true) || is_dir($path);
    }

PS. And there is a conflict with "This condition is duplicated in other if/elseif branch" for similar code:

        if (!is_dir($destDir) && !@mkdir($destDir, 0755, true) && !is_dir($destDir)) {
            trigger_error("Cannot create directory $destDir");
        }

from phpinspectionsea.

marcelloh avatar marcelloh commented on May 21, 2024

somehow when the order is the "adviced order"
if (!@mkdir($dir, 0777, true) and !is_dir($dir))
it still throws a warning or error or something: mkdir(): File exists

But when I change the order into:
if (!is_dir($dir) and !@mkdir($dir, 0777, true))
all is well, without any warning

from phpinspectionsea.

funivan avatar funivan commented on May 21, 2024

@dryabov Why you are using !is_dir before mkdir ?
mkdir is always executed because you are using && operator . So there is no point to check is_dir twice.

from phpinspectionsea.

kalessil avatar kalessil commented on May 21, 2024

Fixed in 2.3.10, which I releasing today evening.

from phpinspectionsea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.