Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#38369 closed defect (bug) (fixed)

Docs: Incorrect return type for get_comments_number()

Reported by: ocean90's profile ocean90 Owned by: kiranpotphode's profile kiranpotphode
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: Comments Keywords: good-first-bug has-patch
Focuses: docs Cc:


get_comments_number() doesn't return an integer. It's a numeric string, for compatibility reasons.

Attachments (2)

38369.diff (551 bytes) - added by kiranpotphode 8 years ago.
Return type changed from int to string.
38369.2.diff (1.7 KB) - added by pkostadinov 8 years ago.
Modify return results, add description and unit test

Download all attachments as: .zip

Change History (7)

8 years ago

Return type changed from int to string.

#1 @kiranpotphode
8 years ago

  • Keywords has-patch added; needs-patch removed

8 years ago

Modify return results, add description and unit test

#2 @pkostadinov
8 years ago

I have modified:

  • the function description, to reflect correctly the return type of the function.
  • the hard-coded return value, to reflect correctly the function description.
  • added new unit test accounting for return type.

#3 @DrewAPicture
7 years ago

  • Owner set to kiranpotphode
  • Status changed from new to assigned

Assigning ownership to mark the good-first-bug as "claimed".

#4 @DrewAPicture
7 years ago

  • Milestone changed from Future Release to 4.9

#5 @DrewAPicture
7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 41285:

Docs: Clarify that get_comments_number() can return either a numeric string (for compatibility reasons) or 0 if the post doesn't exist.

Also update the hook doc for the get_comments_number filter to reflect the mixed type for $count.

Props kiranpotphode for the initial patch.
Fixes #38369.

Note: See TracTickets for help on using tickets.