wordpress-google-cse
wordpress-google-cse copied to clipboard
ERROR: SSL: CA certificate set, but certificate verification is disabled
Hi,
after installing the plugin and saving the API Key and Search Engine ID in settings I get the following error message:
ERROR: SSL: CA certificate set, but certificate verification is disabled
Found the reason for this, on line 83 in google-cse.php:
// Request response
if(is_wp_error($response = wp_remote_get($url, array('sslverify' => false)))) {
return array('error' => array('errors' =>
array(array('reason' => $response->get_error_message()))));
}
sslverify is set to false, yet the latest version of WordPress ships a list of trused certificate roots with the request, so this throws the error.
I imagine earlier versions of WP would not ship a certificate, and thus it would work and/or earlier versions of curl wouldn't throw an error when shipping a certificate + verifyssl=false, however now it does ..
So, to "fix" set sslverify to true:
// Request response
if(is_wp_error($response = wp_remote_get($url, array('sslverify' => true)))) {
return array('error' => array('errors' =>
array(array('reason' => $response->get_error_message()))));
}
Probably best to check WP version though to make it backward compatible.