Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ErrorException: Attempt to read property "id" on null (rollbar #3541) #13549

Merged

Conversation

inietov
Copy link
Collaborator

@inietov inietov commented Aug 30, 2023

Description

For some reason, the notification for license seats checkins breaks, the rollbar only shows occurrences over the demo so I think it's related to that factor. But I added the null coalescing operator anyway, doesn't hurt to be cautious.

Fixes rollbar #3541

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Test Configuration:

  • PHP version: 8.1
  • MySQL version: 8.0.31
  • Webserver version: PHP dev server
  • OS version: Debian 12

@what-the-diff
Copy link

what-the-diff bot commented Aug 30, 2023

PR Summary

  • Improvement in CheckoutableListener.php
    The system's ability to handle and filter queries in situations when certain key information is missing (such as checkoutable ID or the assigned person's ID) has been improved. This increases the system's reliability and prevents potential issues or errors.

Copy link
Collaborator

@marcusmoore marcusmoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indeed an odd error and is so sporadic it probably lines up with the demo resetting.

Help my before-lunch brain process this: Is it possible that $event->checkoutable is null but $event->checkedOutTo matches a user and ends up deleting their pending acceptances? I don't think so because the database wouldn't match on checkoutable_id = null right?

Approving assuming that is true 😅

@inietov
Copy link
Collaborator Author

inietov commented Aug 30, 2023

@marcusmoore Yeah... looks kind of dangerous. But assuming a normal behaviour, 'normally' we don't store any of those as null, I suppose a bug can happen somehow... maybe is safer to check the properties of $event before get the acceptances? If no checkoutTo nor checkoutable, we don't even query the DB...

Thanks for your review!!

@marcusmoore
Copy link
Collaborator

That's good thinking but I think its ok to leave as is.

@inietov
Copy link
Collaborator Author

inietov commented Sep 5, 2023

@snipe good day, what you think. I should check the $event before the query? or is safe to merge as is?

@marcusmoore marcusmoore self-requested a review September 13, 2023 18:29
Copy link
Collaborator

@marcusmoore marcusmoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe is safer to check the properties of $event before get the acceptances? If no checkoutTo nor checkoutable, we don't even query the DB...

Reading this again and knowing we've had a couple quirky rollbars recently I feel like checking $event to make sure checkoutTo and checkoutable are both populated before firing the query, like you said, is safer and will lead to a smaller chance of a bug slipping through in the future.

@inietov inietov requested a review from marcusmoore September 13, 2023 22:35
@inietov
Copy link
Collaborator Author

inietov commented Sep 13, 2023

Sure!!, I just add that condition.

Copy link
Collaborator

@marcusmoore marcusmoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dig it 😄

@snipe snipe merged commit c7b2482 into snipe:develop Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants