-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] use PHP_OS instead of php_uname('s') #16053
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The php_uname() function may be disabled for security reasons.
@johnkary Can you confirm that this change does not break anything for you? |
Thank you @xabbuh. |
fabpot
added a commit
that referenced
this pull request
Oct 2, 2015
This PR was merged into the 2.3 branch. Discussion ---------- [Console] use PHP_OS instead of php_uname('s') | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #15058 | License | MIT | Doc PR | The php_uname() function may be disabled for security reasons. Commits ------- 40e0dc8 use PHP_OS instead of php_uname('s')
This fix doesn't work and introduces a regression. Please see #16095 for an alternate approach. I'm a little frustrated this PR was merged so quickly having only been open for 1 day. I would have appreciated the opportunity to test the fix since I was pinged for feedback. |
fabpot
added a commit
that referenced
this pull request
Oct 7, 2015
…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 | None 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_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 was referenced Oct 27, 2015
Closed
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The php_uname() function may be disabled for security reasons.