Make WordPress Core

Opened 2 months ago

Last modified 8 weeks ago

#64707 new defect (bug)

opcache

Reported by: hupe13's profile hupe13 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Site Health Keywords: has-patch needs-testing changes-requested
Focuses: administration Cc:

Description

WordPress: 7.0-beta1
php 8.5
opcache enabled (file)

The site health checks the existence of opcache in includes/class-wp-site-health.php:

2803: if ( function_exists( 'opcache_get_status' ) )

But opcache_get_status "will not return any information about the file cache". It returns false and site health reports "Opcode cacheDisabled".
See https://www.php.net/manual/en/function.opcache-get-status.php

So WordPress incorrectly reports the existence of opcache.

Change History (3)

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


8 weeks ago
#1

  • Keywords has-patch added

#2 @maulikmakwana2008
8 weeks ago

  • Keywords needs-testing added

Site Health: Fix OPcache detection when file cache is enabled

opcache_get_status() can return false when OPcache file cache is enabled, even though OPcache is active.
This causes Site Health to incorrectly report the opcode cache as disabled.

Update the detection logic to check whether the Zend OPcache extension is loaded and whether opcache.enable is set, and only rely on opcache_get_status() when it returns valid data.

Fixes false negatives for OPcache file cache setups without affecting existing configurations.

#3 @westonruter
8 weeks ago

  • Keywords changes-requested added
Note: See TracTickets for help on using tickets.