Also tried to delete/install Hummingbird plugin afresh – still the same issue.
Hello @eugene212 ,
I’m sorry you are experiencing this issue. Can you tell me what type of server you have? Do you have a reverse proxy on your server? Like Nginx or Caddy?
kind regards,
Kasia
Hi Kasia,
Yes, the site is behind Caddy reverse proxy – for some time Hummingbird was working fine and I could configure it, etc., but at some stage the error appeared and I am not sure what was the trigger.
My other site without reverse proxy has Hummingbird for a couple of years without issues.
Yesterday the same error appeared on the different test/stage site (also behind Caddy) – this time I think it happened after disabling and the enabling again Hummingbird, but I am not 100% sure.
Hi @eugene212,
Thanks for the information. I have passed these to our developer’s attention to check if there are any known instances and any workarounds that could be shared regarding this or not.
Will keep you posted once we get further feedback.
Kind Regards,
Nithin
Not sure if it’s relevant, but I run WP as a docker container behind Caddy reverse proxy.
Hi @eugene212,
I’m afraid this is more specific to the server side. However, could you please try this snippet and see whether it prevents such issues from occuring?
<?php
add_filter( 'http_response', function( $response, $parsed_args, $url ){
if( $parsed_args['method'] === 'GET' && $url === home_url() && ! empty( $response['headers']['server'] ) && is_array( $response['headers']['server'] ) ){
$servers = $response['headers']['server'];
$servers = array_intersect( array('Apache','NGINX','IIS','Cloudflare'), $servers );
if( $servers ){
$response['headers']['server'] = $servers[0];
}else{
$response['headers']['server'] = end( $response['headers']['server'] );
}
}
return $response;
}, 10, 3 );
You can apply the above code as a mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins
Best Regards,
Nithin
Hi @wpmudevsupport11,
The plugin was operational initially, so my impression is that the plugin code itself needs fixing to deal with the error, but for now your snippet indeed helped to get Hummingbird pages back (thank you!) except that the Cache/Integrations still produce the critical error:
When seeking help with this issue, you may be asked for some of the following information: WordPress version 6.1.1 Active theme: Colibri WP (version 1.0.89) Current plugin: Hummingbird (version 3.4.0) PHP version 8.0.26
Error Details
=============
An error of type E_ERROR was caused in line 113 of the file /var/www/html/wp-content/plugins/hummingbird-performance/core/modules/class-cloudflare.php. Error message: Uncaught TypeError: strpos(): Argument #1 ($haystack) must be of type string, array given in /var/www/html/wp-content/plugins/hummingbird-performance/core/modules/class-cloudflare.php:113
Stack trace:
#0 /var/www/html/wp-content/plugins/hummingbird-performance/core/modules/class-cloudflare.php(113): strpos(Array, ‘cloudflare’)
#1 /var/www/html/wp-content/plugins/hummingbird-performance/admin/pages/class-dashboard.php(666): Hummingbird\Core\Modules\Cloudflare->has_cloudflare()
#2 /var/www/html/wp-content/plugins/hummingbird-performance/admin/views/meta-box.php(62): Hummingbird\Admin\Pages\Dashboard->dashboard_browser_caching_module_metabox()
#3 /var/www/html/wp-content/plugins/hummingbird-performance/admin/class-page.php(169): include(‘/var/www/html/w…’)
#4 /var/www/html/wp-content/plugins/hummingbird-performance/admin/class-page.php(374): Hummingbird\Admin\Page->view(‘meta-box’, Array)
#5 /var/www/html/wp-content/plugins/hummingbird-performance/admin/views/wphb-page.php(22): Hummingbird\Admin\Page->do_meta_boxes(‘box-dashboard-l…’)
#6 /var/www/html/wp-content/plugins/hummingbird-performance/admin/class-page.php(169): include(‘/var/www/html/w…’)
#7 /var/www/html/wp-content/plugins/hummingbird-performance/admin/class-page.php(455): Hummingbird\Admin\Page->view(‘wphb-page’)
#8 /var/www/html/wp-content/plugins/hummingbird-performance/admin/class-page.php(443): Hummingbird\Admin\Page->render_inner_content()
#9 /var/www/html/wp-includes/class-wp-hook.php(308): Hummingbird\Admin\Page->render(”)
#10 /var/www/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(”, Array)
#11 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#12 /var/www/html/wp-admin/admin.php(259): do_action(‘toplevel_page_w…’)
#13 {main} thrown
Hi @eugene212,
I’m bringing the errors noticed to our developers attention to see what might have caused it.
Will keep you posted once we get further feedback asap.
Best Regards,
Nithin
Hi @eugene212,
We’ll need additional information in order to troubleshoot this further. Could you please add the following snippet:
<?php
add_action('init', function() {
if ( isset( $_GET['test'] ) ) {
$url = home_url();
$url = add_query_arg( 'wphb-check-cf', 'true', $url );
$head = wp_remote_head(
$url,
array(
'sslverify' => false,
)
);
$headers = wp_remote_retrieve_headers( $head );
print_r( $headers['server'] );
exit;
}
});
Once the snippet is added, please go to the following URL on your website:
https://your-site.com/?test
You’ll have to replace the your-site.com URL in the above with your domain URL and share the information that you get when you load the “?test” in the next reply, so that we could check further and advise what might be causing it.
Looking forward to your response.
Kind Regards,
Nithin
Hi @wpmudevsupport11,
After adding the snippet, I get the following response to …/?test request:
Array ( [0] => Caddy [1] => Apache/2.4.54 (Debian) )
Hi @eugene212,
Thanks for sharing the info. Could you please try this new snippet and see how it goes:
<?php
add_filter( 'http_response', function( $response, $parsed_args, $url ){
if( $parsed_args['method'] === 'GET' && $url === home_url() && ! empty( $response['headers']['server'] ) && is_array( $response['headers']['server'] ) ){
$response['headers']['server'] = 'Caddy';
}
return $response;
}, 10, 3 );
Looking forward to your response.
Best Regards,
Nithin
Hi @wpmudevsupport11,
I have replaced originally suggested snippet with the latest one (using Code Snippets plugin), but the error is still there when trying to enter Hummingbird/Caching/Integrations page – other Hummingbird pages are fine.
Consider if line class-cloudflare.php:113 should use ‘implode’ function to convert an array to string:
if ( isset( $headers[‘server’] ) && strpos( implode($headers[‘server’]), ‘cloudflare’ ) > -1 ) {
After making this change, I can enter Hummingbird/Caching/Integration page.
Hi @eugene212,
Sorry to know the the workaround suggested didn’t helped.
However, we do not recommend editing the core files. I have brought your observation to the notice of our developers and will update you here once we have more insights on this as soon as possible.
Kind Regards,
Nebu John