Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Closed
johnkary wants to merge2 commits intosymfony:2.3fromjohnkary:moreOS400checks

Conversation

@johnkary
Copy link
Contributor

QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#16053
LicenseMIT
Doc PRNone

This PR adds support for detecting the OS400 platform when the PHP functionphp_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 constantPHP_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@eloigranadocommented here asking if we could switch to usingPHP_OS constant 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:

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 donein_array() if case wasn't an issue.

This reverts commit40e0dc8.This commit led to a regression on the OS400 platform, where theconstant PHP_OS returns "AIX" not "OS400".
Copy link
Contributor

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
Copy link
ContributorAuthor

@dosten Thank you for the quick review. I have made the changes you suggested.

@xabbuh
Copy link
Member

@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
Copy link
ContributorAuthor

@xabbuh Thank you for the reference link.

According tophp_uname() docsPHP_OS constant will contain the operating system PHP was _built_ on. Is it possible the system that built PHP is not necessarily the system where it is running?

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
Copy link
Member

Thank you@johnkary.

fabpot added a commit that referenced this pull requestOct 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        | 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
@fabpotfabpot closed thisOct 7, 2015
@eloigranado
Copy link

Thank you for your efforts with this@johnkary and@xabbuh, they are highly appreciated. You have solved the issue in a really more comprehensive way than I could have.

This was referencedOct 27, 2015
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@johnkary@xabbuh@fabpot@eloigranado@dosten@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp