WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Embed GitHub Gist] Fatal error: Cannot use object of type WP_Error as array in …

[Resolved] [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 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.

    Gabe
    ================

    http://wordpress.org/extend/plugins/embed-github-gist/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author dflydev

    @dflydev

    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.

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

    echo $result->get_error_message();

    with

    return $result->get_error_message();

    khalifahkelima

    @khalifahkelima

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] [Plugin: Embed GitHub Gist] Fatal error: Cannot use object of type WP_Error as array in …’ is closed to new replies.