-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP fatal error with PHP 8.1, repo / Composer installation and WP Rocket's debugging enabled #5918
Comments
Duplicated with #5386 |
Reproduce the problemTo reproduce the issue, follow the step given the problem explanation. Identify the root causeThe issue is that, as stated in the problem explanation:
Scope a solutionTo solve the issue, we could change this line : wp-rocket/views/cache/advanced-cache.php Line 49 in cfe483d
to if (version_compare(PHP_VERSION, '8.1.0', '>=')) {
$file = $rocket_path . 'vendor/psr/log/src/' . str_replace('\\', '/', $class) . '.php';
} else {
$file = $rocket_path . 'vendor/psr/log/' . str_replace('\\', '/', $class) . '.php';
} Development steps:Effort estimation:XS Is a refactor needed in that part of the codebase?No |
@Miraeld The path to the to files is depending on the PSR version and not the PHP version. wp-rocket/views/cache/advanced-cache.php Line 42 in 400dcb7
|
Reproduce the problemTo reproduce the issue, follow the step given the problem explanation. Identify the root causeThe main issue here is the version of the librairie which changes the path. Depending on the version we need to load a path or another one. Scope a solutionTo fix this issue, we can add 'WP_Rocket\\Dependencies\\Psr\\Log' => [
$rocket_path . 'inc/Dependencies/Psr/Log/' . str_replace( '\\', '/', $class ) . '.php',
$rocket_path . 'vendor/psr/log/src/' . str_replace('\\', '/', $class) . '.php',
], to wp-rocket/views/cache/advanced-cache.php Line 33 in 400dcb7
And do not forget to delete wp-rocket/views/cache/advanced-cache.php Line 70 in 400dcb7
At the same time, we could refactor this one wp-rocket/views/cache/advanced-cache.php Line 63 in 400dcb7
with the same method. Development steps:Effort estimation:XS Is a refactor needed in that part of the codebase?No |
Seems good to me |
The issue isn't reproducible using 3.15.5, Will close it for now. We can reopen it once it happens. |
Before submitting an issue please check that you’ve completed the following steps:
3.13.2
Describe the bug
When:
8.1.*
is used & the server is running PHP8.1.*
.composer install
.define( 'WP_ROCKET_DEBUG', true);
.the following PHP Fatal error is logged to the
debug.log
:According to @engahmeds3e:
To Reproduce
The steps are described in the Describe the bug section.
Expected behavior
No PHP fatal error should occur when PHP
8.1.*
is used alongside WP Rocket's debugging when the installation was performed using Composer.Additional context
Slack discussion (internal link)
Backlog Grooming (for WP Media dev team use only)
The text was updated successfully, but these errors were encountered: