Missing "header" field added in database query #10214
Merged
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.
If a full URL is redirected the fields selected from the database are "new_url", "header" and "published" but if a server-relative URL is redirected only the fields "new_url" and "published" are selected from the database.
This has two implications:
PHP Notice: Undefined property: stdClass::$header in .../plugins/system/redirect/redirect.php on line 142
This pull request changes the select with the server-relative URL such that in this case the "header" field is selected too.
How to test:
wget
(forwget
see below)Now apply the change and repeat the test, the redirection code is now 307.
Since browsers tend to cache redirections they got from a web server it is not easy to test the redirection plugin. One way is to completely clean the browser cache prior to the next test (or to remove at least all objects cached from the server used for testing).
The other way is to use the tool
wget
as follows:wget -O - --max-redirect 0 <URL>
For please substitute the redirected URL. The relevant output of this tool will look like:
HTTP request sent, awaiting response... 307 Temporary Redirect
Location: <new URL>