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

  1. Anton Timmermans
    Posted 3 years ago #


    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.


    $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:


  2. Zack Katz
    Plugin Contributor

    Posted 3 years 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

  • Gravity Forms Salesforce Add-on
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic