Skip to content

Illegal offset type in isset or empty #2315

@oktaykalfa

Description

@oktaykalfa
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions