Opened 7 years ago
Last modified 3 years ago
#43372 new defect (bug)
$wp_query->max_num_pages return value as float
Reported by: | ironghost63 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | trivial | Version: | 4.9.4 |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
As a page number, Integer would make more sense than Float.
This is not a big problem but kinda annoying when you do strict comparison on this value. since no one will define a page number as float.
Change History (6)
#4
@
3 years ago
I noticed this while working on #47280. All the tests use assertEquals
instead of assertSame
for this reason. The property is indeed documented as an int but is a float.
Note: See
TracTickets for help on using
tickets.
@ironghost63 Welcome to WordPress Trac and thank you for the report.
But there is more!
The example:
displays:
So these counting properties of
WP_Query
have three different types!Within the
WP_Query
class, the inline docs says it's an integer:The calculated value comes from:
but from the PHP docs:
The inline docs for
found_posts
also says:but the data query
returns a string.
So it looks like either we need to adjust the inline docs or adjust the return types.