-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Callback of Model::handleMissingAttributeViolationUsing
called when using isset
to check if attribute exists
#44834
Comments
We have no plans anymore to change this behavior, please see the convo at #44717 |
The discussion in that PR seems to be around something else. This issue is caused by the fact that the offsetExists method tries to catch an exception that will never be thrown. The catch makes sense when no framework/src/Illuminate/Database/Eloquent/Model.php Lines 2239 to 2246 in 0de8734
framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php Lines 465 to 478 in 0de8734
|
Got bit by the same bug, see #44642 (comment). Was a really nice feature, but unusable unless you always directly access the attribute and don't need to check for its existence. In this case, if you for instance report these on production, they're basically false-positives and don't need to be reported. Yet there's no option to disable the reporting or callback when accessed via I tried to work around it using various approaches, but haven't found a viable solution yet. So it's either strict mode and no reporting (not usable on production), or no strict mode (buggy app) 🥲 |
Description:
When a custom callback is defined to handle missing attribute violations (introduced in #44664), then that callback is also called when using the
isset
function to check if an attribute exists. That is not correct, because it is not a violation when usingisset
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: