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

Windows detection is broken #1202

Closed
c33s opened this issue Dec 11, 2016 · 0 comments
Closed

Windows detection is broken #1202

c33s opened this issue Dec 11, 2016 · 0 comments
Assignees

Comments

@c33s
Copy link

c33s commented Dec 11, 2016

in

public function isWindows()

array_key_exists vs in_array

the code should be

    /**
     * Validate if the system is based on windows or not.
     *
     * @return bool
     */
    public function isWindows()
    {
        $keys = [
            'CYGWIN_NT-5.1',
            'WIN32',
            'WINNT',
            'Windows'
        ];
        return in_array(PHP_OS, $keys);
    }

another option would be:

protected function isWin()
{
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        return true;
    }

    return false;
}

or with DIRECTORY_SEPERATOR which is \ on windows

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

No branches or pull requests

3 participants