This repository was archived by the owner on Sep 8, 2021. It is now read-only.
Fix value of PHP_SELF
when router script is in a subdirectory
#12
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.
PHP's built-in web server sets the value of
$_SERVER['PHP_SELF']
differently when the router script is in working directory versus a subdirectory of the working directory. This breaks routing functionality in routing libraries such as Slim.When the script is in the working directory, the value of
PHP_SELF
is the filename of the script, but when run from a parent directory of the script it changes to being the path requested of the web server.This commit changes
bootstrap
behaviour when referring to the Lambda handler. If it refers to a script in a subdirectory of the task root, it changes thechdir
call to enter that directory before running the PHP internal web-server, so that it can refer to the script filename as being in the working directory.This poses no change to how the layer is configured or run, but
PHP_SELF
now correctly refers to the filename and this solves the issue with Slim.Resolves: #11