-
Notifications
You must be signed in to change notification settings - Fork 107
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
Performance Lab Led to a Critical Error with Site Health #1237
Comments
Plugin Version: Performance Lab (version 3.1.0) |
If you deactivate Performance Lab then the error goes away? We'll need to get more information from you about what is going on. Specifically we'll need the specific PHP error that is occuring. Can you get that from the error log? |
Yes, and then site health works again.
|
Thank you. I can see this is a bug introduced in #1179. The code in question: performance/includes/site-health/audit-autoloaded-options/helper.php Lines 105 to 107 in be4c00a
The issue is that you have an autoloaded option which is an array (which is perfectly fine) but the code is assuming all of the options are strings (I guess since previously it was only working with serialized data). Working on a fix... |
Interesting. In testing locally, I'm seeing that @bobbyferran Do you have an external object cache perhaps? |
I have Docket Cache but this was previously installed with performance lab and there was not this issue. This issue just started today without adding any new plugins. I also have WP Fastest Cache and the Bluehost assets only cache. |
OK, thanks. I'm able to reproduce the issue with Docket Cache. It seems when Docket Cache is active it results in if ( 'yes' === $autoload ) {
$alloptions = wp_load_alloptions( true );
$alloptions[ $option ] = $serialized_value;
wp_cache_set( 'alloptions', $alloptions, 'options' );
} So this makes me think that indeed Docket Cache's object cache implementation is incorrect, as it seems to be storing unserialized values instead of serialized ones. I think this should be reported as a bug to Docket Cache, although we should also harden Performance Lab against such object cache implementation bugs. In the mean time, here is some workaround PHP plugin code that "fixes" the Docket Cache compatibility problem: add_filter(
'alloptions',
static function ( array $alloptions ): array {
return array_map(
static function ( $value ): string {
if ( ! is_string( $value ) ) {
return serialize( $value );
} else {
return $value;
}
},
$alloptions
);
}
); |
Ok, thank you. I will also report this issue to Docket Cache. Thank you again. |
@bobbyferran Great. Could you share the link to your Docket Cache issue when you've reported? Also, I've opened #1238 to harden Performance Lab against this issue. |
@westonruter, does this plugin issue alter the behaviour of WP functions in a way that might break the default WP functionality? |
@mukeshpanchal27 Yes, that seems likely. |
Hi there,
Nope. It store cache as plain PHP to get performance benefit from OPcache. You may do a quick fix by adding maybe_serialize: File: includes/site-health/audit-autoloaded-options/helper.php Before: foreach ( $all_options as $option_name => $option_value ) {
$total_length += strlen( $option_value );
} Fix: foreach ( $all_options as $option_name => $option_value ) {
$total_length += strlen( maybe_serialize($option_value));
} Thanks. |
Alright then, thanks. |
Bug Description
Steps to reproduce
Screenshots
Additional Context
<This only occurs with site health. Otherwise, the site works and site health became available again when I disabled performance lab.>
The text was updated successfully, but these errors were encountered: