Avoid partial author ID replacement in posts_where_filter
#565
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 user with the ID of 1 visited the author archive page for a user with the ID of 17, the regex would filter out the
1
of17
and replace with the corresponding guest author ID resulting in a SQL string like'2039'7
. This results in invalid SQL.This PR adds a trailing space to the end of the current user query and requires that space in the
preg_replace()
. There's probably another way to do this by forcing the match to occur at the end of the string, but this is what I've got. :)Query text generated before (bad):
Query text generated after (good):
I think this was introduced in 08c0315.