Skip to content

Commit

Permalink
[BUGFIX] Check all method for existence in OpcodeCacheService
Browse files Browse the repository at this point in the history
The `\TYPO3\CMS\Core\Service\OpcodeCacheService->isClearable()`
method checks for existence of opcache function and if they are
listed in the `disable_functions` configuration.

It seems, that in some environments both methods are missing
and not listed in the disabled methods. Even if this sounds
odd when the opcache extension is installed but both methods are
not available, we add it to the check to avoid the missleading
error message:

	Call to undefined function
	TYPO3\CMS\Core\Service\opcache_reset()

Resolves: #102734
Releases: main, 12.4, 11.5
Change-Id: Icc17a276e8881f502a687db7ca57fc05ecb8981e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82383
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
  • Loading branch information
sbuerk committed Jan 9, 2024
1 parent 8096733 commit 55794e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion typo3/sysext/core/Classes/Service/OpcodeCacheService.php
Expand Up @@ -73,6 +73,8 @@ public function clearAllActive(string $fileAbsPath = null): void
protected static function isClearable(): bool
{
$disabled = explode(',', (string)ini_get('disable_functions'));
return function_exists('opcache_invalidate') && !(in_array('opcache_invalidate', $disabled, true) || in_array('opcache_reset', $disabled, true));
return function_exists('opcache_invalidate')
&& function_exists('opcache_reset')
&& !(in_array('opcache_invalidate', $disabled, true) || in_array('opcache_reset', $disabled, true));
}
}

0 comments on commit 55794e4

Please sign in to comment.