PHPCSStandards / composer-installer

Composer installer for PHP_CodeSniffer coding standards
https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
MIT License
549 stars 36 forks source link

Stabilize a condition #127

Closed jrfnl closed 3 years ago

jrfnl commented 3 years ago

Proposed Changes

While looking into the (non-)race condition described in #125, I noticed a potentially related issue.

As per the documentation of realpath():

realpath() returns FALSE on failure, e.g. if the file does not exist.

In the rare case that realpath() would return false within this plugin, false would subsequently be passed on to is_dir() and is_readable() which both expect a string path.

This tiny change makes the condition fail earlier by checking the return value of realpath().

jrfnl commented 3 years ago

@Potherca Just checking: where there any changed you wanted ? Or did you assign this to me to self-merge ? (sorry, the commit process in this repo still confuses me - I'm used to never self-merge when collaborating, i.e. the (last) approver merges)

Potherca commented 3 years ago

No changes needed. I just didn't feel like waiting around for Travis to complete but also didn't want to use my admin right to merge again. I assigned you in case I forgot to come back to this :joy: