-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: 2.0.0, 1.20.0
-
Component/s: CRUD
-
None
-
None
-
PHP Drivers
-
None
-
None
-
None
-
None
-
None
-
None
When a DocumentCodec is configured in collection options, it is always used to encode the input document.
The input $document can be "array|object",
while DocumentCodec::encode() only accepts "object": https://github.com/mongodb/mongo-php-library/blob/997923252e751768d871a0a6b1a79b8807d3c68d/src/Codec/DocumentCodec.php#L27
Reported by psalm:
PossiblyInvalidArgument
Argument 1 of MongoDB\Codec\DocumentCodec::encode expects object, but possibly different type array<array-key, mixed>|object provided