parse-community / parse-php-sdk

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

fix: Undefined array key `result` #519

Open ajmeese7 opened 2 months ago

ajmeese7 commented 2 months ago

New Pull Request Checklist

Issue Description

The isset method is used to ensure the result key is set before attempting to read it.

Closes: #518

Approach

Added in mocking capabilities to the ParseCloud class so the code changes can be tested.

TODOs before merging

parse-github-assistant[bot] commented 2 months ago

Thanks for opening this pull request!

dplewis commented 2 months ago

Since the results aren't returned in the cloud code function it should return undefined similar to the JS SDK Cloud.js

There's no need to mock as you can create and call a real cloud code function. https://github.com/parse-community/parse-php-sdk/blob/master/tests/cloud-code.js

dplewis commented 1 month ago

@ajmeese7 Can you check the CI? There seems to be a linting issue. I also left a few comments

mtrezza commented 1 month ago

Is this actually fixing a bug or just a refactor to not display a warning message?

ajmeese7 commented 1 month ago

@mtrezza the warning is due to accessing a key that doesn't exist, so I'd consider that a bug. There's no telling if future PHP versions will error out on that, so I figured it's easiest to just solve the problem instead of letting it fester.

And @dplewis I haven't had time to look at your review/comments, I've been busy with other projects, but I'll try to get to that soon.