parse-community / parse-php-sdk

The PHP SDK for Parse Platform
https://parseplatform.org/
Other
811 stars 346 forks source link

Cloud code error #459

Closed YousefAlsbaihi closed 2 years ago

YousefAlsbaihi commented 4 years ago

Issue Description

i'm using parse cloud code to update the user informations using this code below

var SaveObject = Parse.Object.extend(Parse.User);
  var saveObject = new Parse.Query(SaveObject);
  saveObject.equalTo("username", "sam");
  saveObject.first({
    useMasterKey: true,
    success: function(Objects) {
      Objects.save(null, {
        useMasterKey: true,
        success: function(object) {
          object.set("foo":"bar");
          object.save();
          response.success('SUCCESS');
        }
      });
    }
  });

but i still getting the error in php sdk

<br /> <b>Notice</b>: Undefined index: result in <b>/php/vendor/parse/php-sdk/src/Parse/ParseCloud.php</b> on line <b>39</b><br />

Note: i tried every answer that has been posted regard to parse cloud code on here, i couldn't find any answer that can solve this problem.

using PHP V. 7.3.8 Parse Server V.3.9.0 Parse PHP SDK V.1.6.*

davimacedo commented 4 years ago

Can you please share the PHP code that you are using to call the function and also the complete function with the Parse.Cloud.define() clause? Also note that, since you are using 3.9, you need to write your function using the async style: https://github.com/parse-community/parse-server/blob/master/3.0.0.md#migrating-functions

codeKonami commented 2 years ago

I think my issue #483 is linked to this one.

Because the run function always try to return $response['result'] https://github.com/parse-community/parse-php-sdk/blob/b6ad14abea7ddd54eaba60ccd0dbeb4f3a240d23/src/Parse/ParseCloud.php#L39

In case you have an error while calling the function (for example you try to call a cloud function that doesn't exist), you won't received a "result" object and you will get a Undefined index: result error.

mtrezza commented 2 years ago

I'm closing this as it lacks essential information required to investigate the issue. @YousefAlsbaihi please follow up on any questions asked and we can re-open this issue.