You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[5.5] Model->getAttributes() override may cause inconsistency #20902
This change (specifically changing $this->attributes to $this->getAttributes()) is not backwards compatible with some packages / apps that may override the getAttributes() model method. If the attribute values aren't strings, the query builder can't bind them properly right here and you get an "Object could not be converted to string" message.
I'm assuming the attributes are intended to always be strings? Regardless, I wanted to at least bring up the discussion that $this->attributes and $this->getAttributes() could yield different results if the method is overridden. I'm assuming this isn't too common, but it could be considered a breaking change for some.
Steps to Reproduce:
1. Override the getAttributes() method on a model to something like:
changed the title [-]Model->getAttributes() override may cause inconsistency[/-][+][5.5] Model->getAttributes() override may cause inconsistency[/+]on Aug 31, 2017
Activity
[-]Model->getAttributes() override may cause inconsistency[/-][+][5.5] Model->getAttributes() override may cause inconsistency[/+]use $attributes property directly instead of getAttributes() method - c…
themsaid commentedon Sep 1, 2017
Closing as per Taylor's response, seems like the package itself needs to adapt to the change.
austenc commentedon Sep 1, 2017
Yep, I figured this would probably be the case, but wanted to confirm with you guys. Thanks @themsaid!
lintaba commentedon Apr 9, 2018
have the same issue. this helped me:
czim/laravel-paperclip@515a66b
mostafaznv commentedon Jun 10, 2018
refer to this answer, you can fix it with getDirty method
CodeSleeve/laravel-stapler#64 (comment)