Make WordPress Core

Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#57963 closed defect (bug) (fixed)

Fix add method in test suite object-cache.php

Reported by: spacedmonkey's profile spacedmonkey Owned by: spacedmonkey's profile spacedmonkey
Milestone: 6.3 Priority: normal
Severity: normal Version: 4.8
Component: Build/Test Tools Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

In the bundled object-cache.php the add method does not work as expected. The add method, does not check to see if key existing before setting it. Other object caches in the space do this check.

Change History (4)

This ticket was mentioned in PR #4255 on WordPress/wordpress-develop by @spacedmonkey.


2 months ago
#1

  • Keywords has-patch has-unit-tests added

#2 @spacedmonkey
2 months ago

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

In 55577:

Build/Test Tools: Fix issue with add method in object-cache.php.

In the object-cache.php file used for unit tests, the add method did not work as expected. Other object cache plugins and core, have a check to see if the key exists in memory before writing it. Without this check, it used to write unnecessarily to the cache.

Props spacedmonkey, SergeyBiryukov.
Fixes #57963.

#3 @SergeyBiryukov
2 months ago

In 55581:

Tests: Consistently sanitize expiration in the test suite's Memcached implementation.

In a previous commit, the ::sanitize_expiration() call in the ::add() method was moved closer to where the value is used.

This commit does the same for the other methods:

  • ::cas()
  • ::replace()
  • ::set()
  • ::setMulti()

Follow-up to [40561], [55577].

See #57841, #57963.

Note: See TracTickets for help on using tickets.