Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#38369 closed defect (bug) (fixed)

Docs: Incorrect return type for get_comments_number()

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

Description

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 10 years ago.
Return type changed from int to string.
38369.2.diff​ (1.7 KB ) - added by pkostadinov 10 years ago.
Modify return results, add description and unit test

Download all attachments as: .zip

Change History (7)

@kiranpotphode
10 years ago

Return type changed from int to string.

#1 @kiranpotphode
10 years ago

  • Keywords has-patch added; needs-patch removed

@pkostadinov
10 years ago

Modify return results, add description and unit test

#2 @pkostadinov
10 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
9 years ago

  • Owner set to kiranpotphode
  • Status new → assigned

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

#4 @DrewAPicture
9 years ago

  • Milestone Future Release → 4.9

#5 @DrewAPicture
9 years ago

  • Resolution → fixed
  • Status assigned → 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.