WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 3 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 4 years ago.
One more place to clear unneeded code.
11882_tests.patch (1.7 KB) - added by jgadbois 3 years ago.
Unit tests

Download all attachments as: .zip

Change History (9)

comment:1 westi4 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

comment:2 westi4 years ago

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

comment:3 westi4 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.

azaozz4 years ago

One more place to clear unneeded code.

comment:4 nacin4 years ago

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

comment:5 nacin4 years ago

  • Status changed from new to assigned

This ticket is all set except for the unit tests.

comment:6 nacin4 years ago

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

Added to new unit tests report.

jgadbois3 years ago

Unit tests

comment:7 jgadbois3 years ago

  • Cc jgadbois@… added

I added a simple unit test

Note: See TracTickets for help on using tickets.