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

Use php_uname() instead of PHP_OS #3

Open
derUli opened this issue Feb 18, 2019 · 7 comments
Open

Use php_uname() instead of PHP_OS #3

derUli opened this issue Feb 18, 2019 · 7 comments

Comments

@derUli
Copy link

derUli commented Feb 18, 2019

Please note that PHP_OS returns the Operating System where the PHP executable was built.
While in most cases this is equally to the runtime OS, this returns an invalid value if the php interpreter was cross built on another Operating System.

http://php.net/manual/de/function.php-uname.php

@drupol
Copy link

drupol commented Jul 2, 2019

This makes perfect sense.

@drupol
Copy link

drupol commented Jul 2, 2019

I just submitted the pull request, a review would be welcome.

@drupol
Copy link

drupol commented Jul 5, 2019

I ended up doing my own package with a complete different logic: https://github.com/drupol/phposinfo

It's also using php_uname().

@WyriHaximus
Copy link

@derUli out of interest do you have any examples where you can into this?

@danepowell
Copy link

danepowell commented Jul 17, 2019

I agree this makes sense. It's probably rare that people cross compile PHP, but I'm sure it happens. It's simply not right to be using PHP_OS when a more accurate and reliable alternative (php_uname) exists. The PHP documentation for each of those members makes it pretty clear that this is best practice.

@drupol
Copy link

drupol commented Jul 17, 2019

@WyriHaximus I don't have any example under the hand, but I guess that some platforms (RaspBerry, etc etc) are using cross compiled binaries.

@danepowell 👍

@tivie
Copy link
Owner

tivie commented Oct 30, 2020

does anyone have a list of possible php_uname('s') values? Because they don't match PHP_OS

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

No branches or pull requests

5 participants