[13.x] Throw on unencodable JSON in object casts

Merged
XU
9d ago
+47-5

Follow-up to #62175.

AsArrayObject, AsCollection, AsFluent and their encrypted versions silently wipe the column when the value can't be encoded:

// settings: {"theme":"dark","name":"Muller"}
$user->update(['settings' => ['theme' => 'dark', 'name' => "M\xFCller"]]);

// settings: 0