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
When providing an array with non-numeric keys to the Model::upsert method, the behavior in 11.36.0 and older was to use the values of the array as the data. After the changes in #53948, the keys of the array are used as the data, and a database error is returned (because there are no such column names, or because the number of keys does not match the number of values provided).
I understand the rationale for #53948, and I think it makes sense to keep that behavior for Model::insert, but the same behavior makes no sense for Model::upsert because the documentation explicitly describes upsert's first argument as an array of records, not a single record, so using the values makes more sense.
Steps To Reproduce
The following code works in 11.36.0, but crashes with a database error in 11.37.0:
(This is using Laravel's default users table to make it as simple as possible and not need to give a migration as part of the example.)
Laravel Version
11.37.0
PHP Version
8.3.13
Database Driver & Version
PostgreSQL 17
Description
When providing an array with non-numeric keys to the
Model::upsert
method, the behavior in 11.36.0 and older was to use the values of the array as the data. After the changes in #53948, the keys of the array are used as the data, and a database error is returned (because there are no such column names, or because the number of keys does not match the number of values provided).I understand the rationale for #53948, and I think it makes sense to keep that behavior for
Model::insert
, but the same behavior makes no sense forModel::upsert
because the documentation explicitly describes upsert's first argument as an array of records, not a single record, so using the values makes more sense.Steps To Reproduce
The following code works in 11.36.0, but crashes with a database error in 11.37.0:
(This is using Laravel's default
users
table to make it as simple as possible and not need to give a migration as part of the example.)The text was updated successfully, but these errors were encountered: