Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/wp-admin/includes/class-wp-site-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -2802,7 +2802,8 @@ public function get_test_opcode_cache(): array {
$opcode_cache_enabled = false;
if ( function_exists( 'opcache_get_status' ) ) {
$status = @opcache_get_status( false ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- Warning emitted in failure case.
if ( $status && true === $status['opcache_enabled'] ) {
// OPcache reports `opcache_enabled` as false when only the file cache is in use, though that is still an active opcode cache.
if ( $status && ( true === $status['opcache_enabled'] || ! empty( $status['file_cache_only'] ) ) ) {
$opcode_cache_enabled = true;
}
}
Expand Down
3 changes: 2 additions & 1 deletion tests/phpunit/tests/admin/wpSiteHealth.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ public function test_get_test_opcode_cache_return_structure() {
* Covers: opcache enabled, disabled, not available, and opcache_get_status() returns false.
*
* @ticket 63697
* @ticket 65921
*
* @covers ::get_test_opcode_cache()
*/
Expand All @@ -693,7 +694,7 @@ public function test_get_test_opcode_cache_result_by_environment() {
$opcache_enabled = false;
if ( function_exists( 'opcache_get_status' ) ) {
$status = @opcache_get_status( false ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- Warning emitted in failure case.
if ( $status && true === $status['opcache_enabled'] ) {
if ( $status && ( true === $status['opcache_enabled'] || ! empty( $status['file_cache_only'] ) ) ) {
$opcache_enabled = true;
}
}
Expand Down
Loading