Skip to content

[11.x] make the Eloquent missing attribute handler more accurate by changing offsetExists#54654

Merged
taylorotwell merged 2 commits into
laravel:11.xfrom
koenvu:better-exists
Feb 17, 2025
Merged

[11.x] make the Eloquent missing attribute handler more accurate by changing offsetExists#54654
taylorotwell merged 2 commits into
laravel:11.xfrom
koenvu:better-exists

Conversation

@koenvu

@koenvu koenvu commented Feb 17, 2025

Copy link
Copy Markdown
Contributor

We have recently implemented the Model::handleMissingAttributeViolationUsing callback in staging and production environments to allow the request to continue without exceptions, but still be notified about strict mode failures. However, due to the way the offsetExists method is currently implemented, we are getting a lot of false positives on missing attributes when using isset or ?? checks.

This PR aims to resolve that by temporarily disabling the check while retrieving the attribute, and then restoring it to the previous setting.

@taylorotwell taylorotwell merged commit bf9c1ba into laravel:11.x Feb 17, 2025
@koenvu koenvu deleted the better-exists branch February 17, 2025 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants