Embed GitHub Gist
[resolved] Fatal error: Cannot use object of type WP_Error as array in ... (4 posts)

  1. gabesumner
    Posted 5 years ago #

    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 82

    I 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 failed

    I 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.



  2. dflydev
    Plugin Author

    Posted 5 years ago #

    I apologize for the delay on this but these changes have been merged (thanks to CaioProiete's patch) and are included in version 0.8.

  3. rayllu
    Posted 5 years ago #

    This fix doesn't remove the error because it just continues. Replace

    echo $result->get_error_message();


    return $result->get_error_message();

  4. khalifahkelima
    Posted 4 years ago #

    Thanks. It works really well for me. I use the latest version but I still have the error. But after implement:

    return $result->get_error_message();

    It fixed.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Embed GitHub Gist
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic