#62169 closed defect (bug) (fixed)
Use strict comparison in wp_list_comments()
| Reported by: | deepakrohilla | Owned by: | deepakrohilla |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.7 |
| Component: | Comments | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | coding-standards |
Description (last modified by )
A strict comparison should be implemented in the wp-includes/comment-template.php file in wp_list_comments() on line 2291:
if ( $parsed_args['page'] !== $current_cpage || $parsed_args['per_page'] !== $current_per_page ) .
$parsed_args['page'] and $current_cpage, as well as $parsed_args['per_page'] and $current_per_page, both return integer values. I have not observed any of these variables returning a different return type.
Attachments (1)
Change History (6)
This ticket was mentioned in PR #7505 on WordPress/wordpress-develop by @deepakrohilla.
2 years ago
#1
#2
@
2 years ago
- Component General → Comments
- Description modified (diff)
- Focuses coding-standards added
- Summary A strict comparison should be implemented in the wp-includes/comment-template.php in wp_list_comments function → Use strict comparison in wp_list_comments()
#3
in reply to: ↑ description
@
2 years ago
- Milestone Awaiting Review → 6.7
Hi there, thanks for the ticket!
Replying to deepakrohilla:
$parsed_args['page']and$current_cpage, as well as$parsed_args['per_page']and$current_per_page, both return integer values. I have not observed any of these variables returning a different return type.
In my testing, both $current_cpage and $current_per_page are actually a string here, as returned by get_query_var(). Technically $parsed_args['page'] and $parsed_args['per_page'] can be a string too, depending on the type that was passed in, so this would need type casting on both sides for correct comparison.
@SergeyBiryukov commented on PR #7505:
2 years ago
#5
Thanks for the PR! Merged in r59183.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
https://core.trac.wordpress.org/ticket/62169