PHP : Set appropriate SCRIPT variables in $_SERVER superglobal - #1092
Merged
adamziel merged 3 commits intoMar 7, 2024
Merged
Conversation
adamziel
reviewed
Mar 7, 2024
| const json = response.json; | ||
|
|
||
| expect(json).toHaveProperty('REQUEST_URI', '/'); | ||
| expect(json).toHaveProperty('SCRIPT_NAME', '/index.php'); |
Collaborator
There was a problem hiding this comment.
Let's also add a test to see what happens when the file is called test.php is in a subdirectory, e.g. /php/subdirectory/test.php
Collaborator
Author
There was a problem hiding this comment.
@adamziel I added the test you asked. Is it what you expected ?
mho22
deleted the
appropriate-script-name-and-filename-in-server-superglobal-patch
branch
March 8, 2024 11:44
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 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.
What is this PR doing?
Based on the issue #1090
When requesting a url, the current behavior is copying the value from
REQUEST_URItoSCRIPT_NAMEandSCRIPT_FILENAME$_SERVERvariables.It should actually be related to the
PHP_SELFvariable when handling request instead ofREQUEST_URIwhen running code.What problem is it solving?
To avoid a mismatch when using
SCRIPTvariablesTesting Instructions
This should display :
instead of currently :