contao / check

Contao Check
GNU Lesser General Public License v3.0
47 stars 23 forks source link

fix fclose error on failed connection #121

Closed fritzmg closed 7 years ago

fritzmg commented 7 years ago

See https://github.com/contao/check/pull/107#issuecomment-290184167

I have simply moved fclose to the already existing if ($connected).

leofeyer commented 7 years ago

You can further simplify the code.

Current:

$connected = ($connection !== false);

if ($connected) {
    fclose($connection);
    return true;
}

return false;

Simplified:

if ($connection !== false) {
    fclose($connection);
    return true;
}

return false;

There is no need to define a variable $connected which is only used once.

fritzmg commented 7 years ago

True, done.