Opened 7 years ago
Closed 6 years ago
#43299 closed defect (bug) (fixed)
function paginate_comments_links() results in a Notice instead of returning an array when 'type' is set to 'array'
Reported by: | anantajitjg | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.1 | Priority: | normal |
Severity: | normal | Version: | 4.9.4 |
Component: | Comments | Keywords: | has-patch |
Focuses: | template | Cc: |
Description
function paginate_comments_links() produced a Notice ( Array to string conversion in /opt/lampp/htdocs/wordpress/wp-includes/link-template.php on line 2796 ) instead of returning an array when 'type' is set to 'array'. This function does return an array if 'echo' is set to false, which is pretty confusing ( user needs to pass an additional option of 'echo' => false when it is clear that user needs an array ) when used with 'type' => 'array'!!
Expected
paginate_comments_links() when 'type' is set to 'array' must return an array.
Actual
Instead of returning an array, a Notice is produced.
Steps to reproduce
call the function as described below,
<?php $links = paginate_comments_links( array( 'type' => 'array' ) );
Note: WP_DEBUG is set to true
Attachments (2)
Change History (13)
#3
follow-up:
↓ 4
@
7 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
#4
in reply to:
↑ 3
@
7 years ago
- Keywords dev-feedback added
Replying to SergeyBiryukov:
In 42703:
Hi,
This is a follow-up to above bug. If I use paginate_comments_links() with no options passed it will result in, Notice: Undefined index: type in /opt/lampp/htdocs/wordpress/wp-includes/link-template.php on line 2928 when WP_DEBUG is set to true. That's why I set, 'type' => 'plain' in defaults array. May be a better solution can remove this Notice :)
#5
@
7 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
If I use paginate_comments_links() with no options passed it will result in, Notice: Undefined index: type in /opt/lampp/htdocs/wordpress/wp-includes/link-template.php on line 2928 when WP_DEBUG is set to true.
With reference to #comment:4 I am proposing an alternative solution!
In 42703: