Skip to:

#8727 closed defect (bug) (fixed)

452 failing tests due to wrong use of cache key

Reported by: imath's profile imath Owned by: imath's profile imath
Milestone: 11.0.0 Priority: high
Severity: major Version:
Component: Core Keywords: has-patch commit


I believe the reason is in WP's 53818 changeset. The WP Cache API is less permissive in WordPress 6.1 and throws "Unexpected incorrect usage notice" when the cache key is not an integer nor a not empty string.

After a analysing the 2 first failing tests it looks like it corresponds to:

  • an activity comment created without the parent activity inside the test (not a regular usage).
  • a group is created and the membership id is null for the creator at the time the 'groups_member_before_save' hook is fired (regular usage)

I'm adding a first patch about it to illustrate the 2 fixes.

450 failing tests left to fix.. which is a lot!

Attachments (2)

8727.patch (2.0 KB) - added by imath 21 months ago.
8727.2.patch (4.1 KB) - added by imath 21 months ago.

Download all attachments as: .zip

Change History (4)

21 months ago

21 months ago

#1 @imath
21 months ago

  • Keywords has-patch commit added; needs-patch removed

Well it was more impressive than critical 😅. .2.patch is fixing the issue.

#2 @imath
21 months ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 13309:

Adapt to WP Cache API latest change about cache key requirements

In WordPress 6.1, a cache key needs to be an integer or a "not empty" string. See WP53818 changeset.

After analysing the failing PHPUnit failing tests, it seems we were not careful enough about cache key checks in a few cases:

  • When generating an activity comment without a corresponding parent activity in our tests.
  • When trying to cache a group membership ID for the group creator before this membership has been created.
  • When trying to check if a member had a member type or a group had a group type using an empty string although into 2 of our unit tests.

Fixes #8727

Note: See TracTickets for help on using tickets.