• Resolved noplanman

    (@noplanman)


    Hi,

    I’m making use of the API connection in some custom code and have run into a bug.

    When making PATCH requests, the body is being double-encoded.

    This first encoding happens when preparing the request here.
    The double happens just before dispatching it here.

    (same thing for OAUTH1 here and here)

    Fix is to remove the secondary json_encode in the patch() and http_patch() methods.

    My use-case: adding and removing tags, which requires multi-level arrays.

    P.S. Is the source code in a public repository and open to PRs somewhere?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey,

    I have talked to the developers of the integration and it looks like that is line is something that was left in and is not used by the plugin at all.

    The suggested work around would be using something like
    $this->get_api_response($url, wp_remote_request($url, $options));
    I know this is not ideal.
    What you could do as well is make your own integration and then make your own patch request. I hope this help but please let me know if you have any further questions.

    Thread Starter noplanman

    (@noplanman)

    Hi Steve,

    Thanks for your reply.

    To be quite frank, I can’t understand how an official plugin from AWeber doesn’t fix a bug in their code, even if it’s not used internally.

    I’d expect the API provided by this plugin to be the truest reflection of the AWeber API, so that any developers who would like to create simple extensions, can use this plugin as a base. Forking for my own needs is always the last option for me, as a fix would benefit everyone!

    If the code were open source I’d be more than happy to make a fix.

    P.S. I’ve seen other plugins that use the AWeber API code that’s in this plugin, and they have the bug too…

    Thread Starter noplanman

    (@noplanman)

    Hello again,

    I’m flabbergasted with the latest update to the plugin, version 7.3.3.

    Instead of fixing a single line of code, the decision has been made to remove parts of the API…

    Very sad to see how actively AWeber doesn’t want to create a developer-friendly experience here.

    Uninstalling now…

    Thank you for pointing out the unused function inside the plugin. As it was not being used by our plugin it was removed.

    While I understand you were attempting to use a function inside the AWeber WordPress plugin to make another plugin, that is not a supported use of our plugin. Piggybacking off the existing AWeber oauth connection inside our plugin for your own plugin is a violation of user trust and a potential security vulnerability. If you are writing a WordPress plugin, please register your own developer profile and use the credentials issued for that specific plugin so end users have a clear delineation of who’s doing what with their data.

    A developer profile can be created free at https://labs.aweber.com/
    Docs for API functions can be found at https://api.aweber.com/

    -Tom Kulzer

    Thread Starter noplanman

    (@noplanman)

    Hi Tom,

    Thank you for the clear response.

    Since this plugin is developed by AWeber itself, I wrongly assumed it was the safest way to do this.

    It is very clear now that I need to develop our own integration, which I’ll go ahead and do.

    Armando

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Double json_encode for PATCH requests’ is closed to new replies.