parse-php-sdk
parse-php-sdk copied to clipboard
fix: Undefined array key `result`
New Pull Request Checklist
- [x] I am not disclosing a vulnerability.
- [x] I am creating this PR in reference to an issue.
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
- [x] Add tests
- [x] Add changes to documentation (guides, repository pages, in-code descriptions)
- [ ] Add changelog entry
Thanks for opening this pull request!
- 🎉 We are excited about your hands-on contribution!
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
@ajmeese7 Can you check the CI? There seems to be a linting issue. I also left a few comments
Is this actually fixing a bug or just a refactor to not display a warning message?
@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.