parse-php-sdk icon indicating copy to clipboard operation
parse-php-sdk copied to clipboard

fix: Undefined array key `result`

Open ajmeese7 opened this issue 1 year ago • 5 comments

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

ajmeese7 avatar Jun 08 '24 01:06 ajmeese7

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

dplewis avatar Jun 13 '24 19:06 dplewis

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

dplewis avatar Jun 28 '24 14:06 dplewis

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

mtrezza avatar Jun 28 '24 22:06 mtrezza

@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.

ajmeese7 avatar Jun 29 '24 13:06 ajmeese7