-
Type: Improvement
-
Resolution: Works as Designed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: Laravel
-
None
https://github.com/mongodb/laravel-mongodb/issues/2639
- Laravel-mongodb Version: 10.25.2
- PHP Version: 8.2.11
- Database Driver & Version: 4
Description:
When triyng to set a key of object as integer on update it throws a type error
Steps to reproduce
Set a key as integer on updateOrCreate
Model::updateOrCreate(['_id' => 1], [ 1 => "value"])
Actual behaviour
It throws an error in MongoDB\Laravel\Eloquent\Model::216
str_contains(): Argument #1 ($haystack) must be of type string, int given
My sugesstion is change the code from
if (str_contains($key, '.')) {
to
if (is_string($key) && str_contains($key, '.')) {
- related to
-
PHPORM-100 Support filter on numeric field name
- Closed