Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Console] Add additional ways to detect OS400 platform#16095
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This reverts commit40e0dc8.This commit led to a regression on the OS400 platform, where theconstant PHP_OS returns "AIX" not "OS400".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This check can be omitted IMO, we can be sure that thePHP_OS constant exists.
johnkary commentedOct 3, 2015
@dosten Thank you for the quick review. I have made the changes you suggested. |
xabbuh commentedOct 3, 2015
@johnkary Thank you for the review. Onhttp://www.volubis.fr/php/ibmdemo/showsource.php?filename=checkauth.inc I found this check: // If we report the OS as AIX or OS400, assume we're running under PASE$isPase = (PHP_OS =="AIX" ||PHP_OS =="OS400"); Should we do it similarly here? |
johnkary commentedOct 3, 2015
@xabbuh Thank you for the reference link. According tophp_uname() docs I'm not an IBM expert, nor do I admin IBM servers. I can only offer evidence from the 1 server I have access to. PHP_OS constant returns "AIX" on that server. Maybe AIX is the deciding factor when we should redirect output, instead of OS400? I'm willing to rework the PR if others think that is a better approach. |
fabpot commentedOct 7, 2015
Thank you@johnkary. |
…hnkary)This PR was squashed before being merged into the 2.3 branch (closes#16095).Discussion----------[Console] Add additional ways to detect OS400 platform| Q | A| ------------- | ---| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#16053| License | MIT| Doc PR | NoneThis PR adds support for detecting the OS400 platform when the PHP function `php_uname()` is disabled. OS400 platform detection was added in#15058 to fix character encoding issues present on OS400. See that PR for more info.This PR fixes regression introduced in#16053, which did not work on the IBM OS400 server I have access to. The constant `PHP_OS` being checked outputs "AIX" on my IBM OS400 server. I can't say for sure if it works on other IBM platforms... but I preserved this check just in case.User@eloigranado [commented here](#15058 (comment)) asking if we could switch to using `PHP_OS` constant instead of `php_uname()` because he claims some admins might "[hide] the exact kernel build from any attacker who discovers a remote PHP code execution vulnerability". I personally don't think we should accommodate this use case, but I was able to find alternate approaches.### Why use case insensitive string matching stristr() instead of in_array()?Here are the various outputs on my OS400 server: echo PHP_OS; // "AIX" echo getenv('OSTYPE'); // "os400" echo php_uname('s'); // "OS400"So we have various case issues here, and possible blank values on platforms where OSTYPE var doesn't exist or php_uname() is disabled. Concatenating these optional values together delimited by ; then case-insensitive searching the string for "OS400" seemed like a fair compromise. I would've probably done `in_array()` if case wasn't an issue.Commits-------96a4071 [Console] Add additional ways to detect OS400 platform
This PR adds support for detecting the OS400 platform when the PHP function
php_uname()is disabled. OS400 platform detection was added in#15058 to fix character encoding issues present on OS400. See that PR for more info.This PR fixes regression introduced in#16053, which did not work on the IBM OS400 server I have access to. The constant
PHP_OSbeing checked outputs "AIX" on my IBM OS400 server. I can't say for sure if it works on other IBM platforms... but I preserved this check just in case.User@eloigranadocommented here asking if we could switch to using
PHP_OSconstant instead ofphp_uname()because he claims some admins might "[hide] the exact kernel build from any attacker who discovers a remote PHP code execution vulnerability". I personally don't think we should accommodate this use case, but I was able to find alternate approaches.Why use case insensitive string matching stristr() instead of in_array()?
Here are the various outputs on my OS400 server:
So we have various case issues here, and possible blank values on platforms where OSTYPE var doesn't exist or php_uname() is disabled. Concatenating these optional values together delimited by ; then case-insensitive searching the string for "OS400" seemed like a fair compromise. I would've probably done
in_array()if case wasn't an issue.