Opened 3 months ago
Last modified 3 months ago
#23383 new defect (bug)
High archive page numbers cause invalid database queries
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Database | Version: | trunk |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by Viper007Bond)
Visiting http://www.viper007bond.com/category/videos/page/6805063692754011230 on my site generates the following database query:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (21) ) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 6.805063692754E+19, 10
Note the scientific notation LIMIT value.
Change History (4)
comment:1
Viper007Bond — 3 months ago
- Description modified (diff)
comment:2
Viper007Bond — 3 months ago
comment:4
SergeyBiryukov — 3 months ago
Replying to Viper007Bond:
No idea where this other LIMIT is coming from.
Caused by absint() in WP_Query::parse_query():
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/query.php#L1449

Interestingly I cannot reproduce this locally, so it may be 32bit vs 64bit or something. The same paged value results in this query:
SELECT SQL_CALC_FOUND_ROWS wp_trunk_posts.ID FROM wp_trunk_posts INNER JOIN wp_trunk_term_relationships ON (wp_trunk_posts.ID = wp_trunk_term_relationships.object_id) WHERE 1=1 AND ( wp_trunk_term_relationships.term_taxonomy_id IN (1) ) AND wp_trunk_posts.post_type = 'post' AND (wp_trunk_posts.post_status = 'publish' OR wp_trunk_posts.post_status = 'private') GROUP BY wp_trunk_posts.ID ORDER BY wp_trunk_posts.post_date DESC LIMIT 21474836460, 10
No idea where this other LIMIT is coming from.