WordPress.org

Ready to get started?Download WordPress

Forums

Gravity Forms Salesforce Add-on
[resolved] Response code bug (2 posts)

  1. Anton Timmermans
    Member
    Posted 1 year ago #

    Hello,

    I have found a bug in the gravity forms salesforce add-on. With no better place to post it I post it here.

    When I tried to activate my clients salesforce organization ID I got the nice message: "Salesforce.com is temporarily unavailable. Please try again in a few minutes.". Which wasn't true ofcourse, so I decided to dig in the code.

    What I found was that salesforce correctly returns a response but it wasn't handled correctly. The line that checks this is line 456 in salesforce.php:

    if(wp_remote_retrieve_response_code($result) !== 200) { // Server is down.

    In the codex for 'wp_remote_retrieve_response_code' it states that this function returns a string, in my investigation I have found that wordpress return a string or an integer, for me depending on the environment (different servers yield different results).

    So this line should be rewritten to either one of these to fix the bug:

    if(wp_remote_retrieve_response_code($result) != 200) { // Server is down.

    or

    $res_code = wp_remote_retrieve_response_code($result);
    if($res_code !== 200 && $res_code !== '200') { // Server is down.

    Depending on what best fits your goal with that line of code.

    I hope I have provided you with enough detail to quickly fix this bug so I don't have to be afraid an update overwrites this fix.

    PS. I guess this should solve the following tickets as well:
    http://wordpress.org/support/topic/plugin-gravity-forms-salesforce-add-on-salesforcecom-is-temporarily-unavailable-please-try-again-in-a-few-minutes?replies=2
    http://wordpress.org/support/topic/web-to-lead-salesforcecom-is-temporarily-unavailable-please-try-again-in-a-f

    http://wordpress.org/extend/plugins/gravity-forms-salesforce/

  2. Zack Katz
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks @atimmer, I'm releasing a fix based on your code. Very helpful indeed! :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic