laravel-mongodb icon indicating copy to clipboard operation
laravel-mongodb copied to clipboard

Illegal offset type in isset or empty

Open oktaykalfa opened this issue 4 years ago • 1 comments

  • Laravel: 8.60.0
  • mongodb Version: 3.8.4
  • PHP Version: 8.0.10
  • Database Driver & Version: mongodb-1.10.0

Description:

Hello,

Im using laravel with mongoDB and having a poblem while sending notification. Im sending notifications to queue/job like this: https://i.ibb.co/55Lxwgv/1-ss.png

And Laravel doing something on this process then throwing error: Illegal offset type in isset or empty

Before the explain: if you try to get user->id like this, you will get something like this because im using mongoDB. MongoDB\BSON\ObjectId {#695 +"oid": "58bab4018803fa0008413732" }

Why am getting this illegal offset error? Let me give more detail:

in Illuminate\Support\Collection class, these two functions want string value but since i use mongoDB, it comes as like this: https://i.ibb.co/jkbyWhN/2-ss.png MongoDB\BSON\ObjectId {#695 +"oid": "58bab4018803fa0008413732" }

then it throws an error. if i manipulate it in the plugin(i do not prefer) its work properly.

Is this problem with Laravel itself, or MongoDB? I also added trace log.

https://github.com/jenssegers/laravel-mongodb/files/7171495/trace-log.txt

oktaykalfa avatar Sep 15 '21 15:09 oktaykalfa

any update?

oktaykalfa avatar Sep 29 '21 10:09 oktaykalfa