[13.x] Throw on unencodable JSON path values

Merged
XU
10d ago
+18-2

Setting a JSON path to a value that can't be encoded silently wipes the whole column:

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

// settings: 0

Updating the whole attribute with the same value already throws:

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

// JsonEncodingException: Unable to encode attribute [settings] ... Malformed UTF-8 characters

This makes the -> path throw the same way.