Opened 6 years ago
Closed 6 years ago
#3894 closed defect (bug) (fixed)
Avoid expensive database queries from redirect_canonical on 404's
Reported by: | dd32 | Owned by: | dd32 |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Support Forums | Keywords: | |
Cc: |
Description
There's some URLs on the Support Forum which are triggering OOM fatal errors when requested, such as the following:
https://wordpress.org/support/topic/test/*1*
This is caused as it doesn't match an existing topic, and it causes WordPress to perform a query like this, which has thousands of results in the forums:
SELECT ID FROM wp_posts WHERE post_name LIKE '1%' AND post_type IN ('post', 'page', 'attachment', 'forum', 'topic', 'reply', 'helphub_article', 'helphub_version') AND post_status = 'publish'
The following commit avoids these by requiring that the name
query var is at least 5 characters long, which appears to be long enough to reduce the number of DB rows to avoid fatal errors while also allowing for redirects when a partial post_name is provided.
Change History (1)
Note: See
TracTickets for help on using
tickets.
In 7806: