[Plugin: Embed GitHub Gist] Fatal error: Cannot use object of type WP_Error as array in …
-
First, I want to thank the author of this plug-in for creating Embed GitHub Gist.
—
I encountered the following error when trying to use this however:
Fatal error: Cannot use object of type WP_Error as array in C:\mywebsite\wp-content\plugins\embed-github-gist\embed-github-gist.php on line 82I did some digging and found that the follow error was being generated by the WP_Http request:
SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failedI don’t 100% understand why the SSL verification is failing. I also don’t understand why GitHub is using SSL for these requests. I’m openly sharing these code samples on my blog, so I have nothing to hide.
Consequently, my solution was to simply disable the SSL verification. Below is the code snippet I used for this:
$args = array('sslverify' => false); $result = $http->request('https://gist.github.com/' . $id . '.json' . $file, $args); if ( is_wp_error($result) ) echo $result->get_error_message(); $json = json_decode($result['body']);My PHP skills are a bit rusty, so this took me awhile to figure out. Hopefully this post will help someone else.
Best wishes, and thanks again for this wonderful plug-in.
Gabe
================
The topic ‘[Plugin: Embed GitHub Gist] Fatal error: Cannot use object of type WP_Error as array in …’ is closed to new replies.