This repository was archived by the owner on Jan 29, 2020. It is now read-only.
fix(WhoopsError): ensure the SCRIPT_NAME is set before attempting to use it#489
Merged
weierophinney merged 2 commits intozendframework:masterfrom Oct 9, 2017
Merged
fix(WhoopsError): ensure the SCRIPT_NAME is set before attempting to use it#489weierophinney merged 2 commits intozendframework:masterfrom
weierophinney merged 2 commits intozendframework:masterfrom
Conversation
This was referenced May 26, 2017
|
|
||
| if (isset($serverParams['SCRIPT_NAME'])) { | ||
| $scriptName = $serverParams['SCRIPT_NAME']; | ||
| } |
Contributor
There was a problem hiding this comment.
This can be cleaned up to:
$serverParams = $request->getServerParams();
$scriptName = (isset($serverParams['SCRIPT_NAME'])) ? $serverParams['SCRIPT_NAME'] : '';
It'll be nice when ZE is pinned to PHP 7.1 and we can use null coalesce operators...
Contributor
Author
There was a problem hiding this comment.
Always found it bizarre that people think this is "cleaner". I didn't realise I had written really unwieldily code here. I guess the above is also using a ternary operator so it does at least make it consistent.
weierophinney
added a commit
that referenced
this pull request
Oct 9, 2017
fix(WhoopsError): ensure the SCRIPT_NAME is set before attempting to use it
weierophinney
added a commit
that referenced
this pull request
Oct 9, 2017
weierophinney
added a commit
that referenced
this pull request
Oct 9, 2017
weierophinney
added a commit
that referenced
this pull request
Oct 9, 2017
Forward port #489 Conflicts: CHANGELOG.md
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
PSR states
Nothing suggests that
SCRIPT_NAMEwill always exist. Therefore I've added aisset()guard and left the default as an empty string.