[3.0] Stop logging an error for every personal message search - #9465
Open
albertlast wants to merge 1 commit into
Open
[3.0] Stop logging an error for every personal message search#9465albertlast wants to merge 1 commit into
albertlast wants to merge 1 commit into
Conversation
Searching your personal messages put a row in the error log every time:
2: Undefined array key "start"
/index.php?action=pm;sa=search2
Search::performSearch() reads the start twice. The first read guards
itself, the second does not, and a search arrives without one - only the
page links a member clicks afterwards carry it.
The value is already on hand as $this->start, read once and guarded when
the search was set up, so use that. PageIndex takes its start by reference
and clamps it, which is the whole point of the comparison below, so it
gets a copy and the original stays around to compare against.
Out of range starts still redirect: start=999 and start=-5 both come back
as ;start=0. A plain search adds nothing to the log now.
Signed-off-by: Mathias Albert <mathiaspapealbert@hotmail.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
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.
Description
Searching your personal messages puts a row in the error log every time:
Search::performSearch()reads the start twice, and only one of the two guards itself:A search arrives without a start — only the page links a member clicks afterwards carry one — so the second read fires on the first search anyone runs.
The value is already on hand as
$this->start, read once and guarded when the search was set up, so this uses that instead of reading$_GETa third time.PageIndextakes its start by reference and clamps it, which is what makes the comparison below meaningful, so it gets a copy and the original stays to compare against. That is the same shapeItemList::buildPageIndex()uses.Checked that the redirect still does its job:
sa=search2(POST, no start)sa=search2sa=search2;start=0sa=search2;start=0sa=search2;start=999…;start=0sa=search2;start=-5…;start=0Same one result found in every case.
Issues References (Fixes|Related|Closes)
n/a