Fix EZP-22982: Treemenu throws PHP notices with nginx #1111
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.
Link: https://jira.ez.no/browse/EZP-22982
Description
First of all, this patch is more of a workaround than a fix. It avoids the notice to happen, but doesn't optimize the behavior as it is done using apache.
$_SERVER['PHP_SELF']
is not processed the same way in apache (with mod_rewrite) and nginx. Apache applies the rewrite rules on the returned value while nginx doesn't apply them returning a result matching what is specified in the doc http://php.net/manual/en/reserved.variables.server.phpFor example requesting
http://ez5.local/ezdemo_site_admin
the value of$_SERVER['PHP_SELF']
would be:/ezdemo_site_admin/
index.php/ezdemo_site_admin
Ways to fix it:
$_SERVER['PHP_SELF']
by$_SERVER['REQUEST_URI']
: That could lead to a lot of BC breaksThat's why I decided in this PR to go with the safest approach (a workaround) since we are dealing with legacy code.
Test
Manual test (on front and back) and ran the install wizard.