Closed PatrickSJ closed 1 year ago
Hey, this is actually a Laravel bug. I've made an upstream PR with a fix - https://github.com/laravel/framework/pull/47170.
As a temp fix I've simply added the following to all my files using Js::from
as this clears the error.
@php
// Clears last JSON error to prevent false error. See:
// https://github.com/itsgoingd/clockwork/issues/632
// https://github.com/laravel/framework/pull/47170
json_decode('{}');
@endphp
To reproduce:
{{ Js::from(User::find(1)) }}
to the viewError will appear stating
Error encoding model [App\Models\User] with ID [1] to JSON: Syntax error
orError encoding model [App\Models\User] with ID [1] to JSON: Malformed UTF-8 characters, possibly incorrectly encoded
. If the error does appear on the first page load just refresh the page.Error will go away if Clockwork is disabled in config/clockwork.php.