-
-
Notifications
You must be signed in to change notification settings - Fork 718
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
[Laravel 7] json_decode error when updating a json-field #680
Comments
This happened to me too when using attribute casting. I have a field casted to object and it produces the same error. What I did is I created a custom casts (https://laravel.com/docs/7.x/eloquent-mutators#attribute-casting) and it worked. |
Hey, |
yes my entire cms broke |
@kapersoft I guess this is bug for laravel ... i had to change all my casts with the custom one because my entire site became unusable. |
@developer-ssr |
I've created a PR for this issue: #681 |
Any update on this issue please? Seems we've reached a bit of a stalemate ;) |
Hey all, |
Brilliant, thanks everyone for their efforts! |
@Gummibeer |
@Gummibeer it's fine by me! |
released: https://github.com/spatie/laravel-activitylog/releases/tag/3.11.2 |
See spatie/laravel-activitylog#680 for more info
Hi folks,
In my project I am using this awesome package to log changes in my models. Today I started the upgrade from Laravel 6 to Laravel 7 and stumbled onto a problem when logging an json field.
In my model I have a json field with unstructured data. In the model the json is field is casted to array using
protected $casts = ['json_field' => 'array'];
. I have added to field to the activity log usingprotected static $logAttributes = ['json_field'];
. When I update this field the following error pops up:See https://flareapp.io/share/VmeYkqmQ for the stacktrace. Removing the
LogsActivity
-trait or migration back to Laravel 6 will solve this error, but that's obviously not an option.I have made a small example repo with the problem at https://github.com/kapersoft/laravel-activity-json-error. Follow the steps in the readme to seed your database and create a webserver. If you hit the route http://127.0.0.1:8000/activity-error, the error will pop up.
Does anyone has an idea why this error appears? Is there something wrong in the package or do I have to change some things to get this working again?
The text was updated successfully, but these errors were encountered: