Make WordPress Core

Opened 25 hours ago

Last modified 23 hours ago

#65921 new defect (bug)

get_test_opcode_cache() does not detect OPcache file cache

Reported by: benniledl Owned by:
Priority: normal Milestone: Awaiting Review
Component: General Version:
Severity: normal Keywords: has-patch has-unit-tests close
Cc: Focuses:

Description

get_test_opcode_cache() uses opcache_get_status() to detect whether OPcache is active.

However, opcache_get_status() only reports the in-memory opcode cache. When using OPcache with only opcache.file_cache_only, the cache is therefore not correctly recognized.

As a result, tests relying on get_test_opcode_cache() may incorrectly assume that no opcode cache is enabled.

The function should also account for configurations where opcache.file_cache is enabled without the in-memory cache.

Change History (2)

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


23 hours ago
#1

  • Keywords has-patch has-unit-tests added

Site Health reports "Opcode cache is not enabled" on servers running OPcache with opcache.file_cache_only turned on, even though a file-based opcode cache is active.

get_test_opcode_cache() treats opcache_get_status()['opcache_enabled'] as the only signal, but OPcache sets that flag to false in file-cache-only mode and instead exposes a file_cache_only key. The patch accepts either signal. That key is present only when the file cache is the active backend, so shared memory configurations are unchanged.

The change only widens what counts as enabled, so no configuration that currently passes can start failing.

Trac ticket: https://core.trac.wordpress.org/ticket/65921

## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Investigating the OPcache behaviour, drafting the one-line fix, and updating the existing test's environment check. All changes were reviewed and validated by me.

#2 @siliconforks
23 hours ago

  • Keywords close added

Is this the same as #64707?

Note: See TracTickets for help on using tickets.