Problem/Motivation

Background:
We are querying Salesforce in our custom module to check if a user exists in Salesforce when users sign up to our Drupal site. To do that we're using the Rest client ("salesforce.client" service) along with the Drupal\salesforce\Commands\QueryResult class to parse the Rest call result. We're also using the "AjaxLogin" module which allows users to register using Ajax.

The issue:
When a user registers via Ajax, they get an Ajax error, the status code is 200, but the reason for the error is "parseerror".

The reason for the parse error is there's empty Array() outputs in our ajax json response just before the actual json array of commands.

This is output because when we instantiate "QueryResult" class in our hook_user_insert empty `Array()`s get output in our json response because there's a print_r in the constructor of QueryResult class.

Proposed resolution

Remove the print_r from the constructor. Or please advise us if we should be using a different class or method to parse Rest call results.

CommentFileSizeAuthor
#2 3186237-remove-queryresult-print-r-2.patch522 bytesbaysaa

Comments

Baysaa created an issue. See original summary.

baysaa’s picture

Status: Active » Needs review
StatusFileSize
new522 bytes

Attached patch thanks!

aron novak’s picture

Status: Needs review » Reviewed & tested by the community

This looks necessary.

  • AaronBauman committed f983505 on 8.x-4.x authored by Baysaa
    Issue #3186237 by Baysaa: Remove the print_r in the QueryResult...
aaronbauman’s picture

Status: Reviewed & tested by the community » Fixed

Yeah, no brainer.
Thanks for the patch

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.