WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#11882 closed defect (bug) (fixed)

get_pending_comments_num has inconsistent behaviour

Reported by: westi Owned by: westi
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Comments Keywords: needs-unit-tests
Focuses: Cc:

Description

You sometimes get and array and sometime not even when you should.

It only return numbers for posts with pending comments.

It needs some tests

Attachments (2)

11882.patch (438 bytes) - added by azaozz 6 years ago.
One more place to clear unneeded code.
11882_tests.patch (1.7 KB) - added by jgadbois 5 years ago.
Unit tests

Download all attachments as: .zip

Change History (9)

#1 @westi
6 years ago

[12596] - Introduced a bug while trying to fix issues surrounding this before.

Have had reports of notices like:

Warning: number_format() expects parameter 1 to be double, array given in wp-admin/includes/template.php on line 2275

#2 @westi
6 years ago

(In [12715]) Improve get_pending_comments_num() to be a little more predictable and revert the erroneous change in [12596]. See #11882.

#3 @westi
6 years ago

  • Keywords needs-unit-tests added

So far I have been manually testing this and I think we have possibly more dead code we can remove.

I also want to write some unit tests for this.

@azaozz
6 years ago

One more place to clear unneeded code.

#4 @nacin
6 years ago

(In [14156]) Remove dead code. props azaozz, see #11882.

#5 @nacin
6 years ago

  • Status changed from new to assigned

This ticket is all set except for the unit tests.

#6 @nacin
6 years ago

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

Added to new unit tests report.

@jgadbois
5 years ago

Unit tests

#7 @jgadbois
5 years ago

  • Cc jgadbois@… added

I added a simple unit test

Note: See TracTickets for help on using tickets.