-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
$packedArray = MongoDB\BSON\PackedArray::fromPHP([1, 2, 3]); var_dump($packedArray->toPHP(['root' => 'bson']));
This produces the following output:
object(MongoDB\BSON\Document)#2 (1) { ["data"]=> string(36) "GgAAABAwAAEAAAAQMQACAAAAEDIAAwAAAAA=" }
I'll concede that the type map doesn't make much sense on its own, although the above "root" option could certainly accompany a more complex type map and the output would be the same.
I would have expected the result to be a PackedArray, although this may be intentional since we're interpreting the PackedArray as a root document. In that case, this behavior may be closely related to PHPC-2219.
- is related to
-
PHPLIB-1122 Support Document and PackedArray objects in public APIs
- Closed
-
PHPC-326 Document and PackedArray classes to represent raw BSON data
- Closed
-
PHPC-2219 Prohibit serializing PackedArray instances as root documents
- Closed