Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#57963 closed defect (bug) (fixed)

Fix add method in test suite object-cache.php

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

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.


3 years ago
#1

  • Keywords has-patch has-unit-tests added

#2 @spacedmonkey
3 years ago

  • Owner set to spacedmonkey
  • Resolutionfixed
  • Status newclosed

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
3 years 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.