File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -101,11 +101,9 @@ function apply_type_map_to_document($document, array $typeMap)
101
101
* This is used to facilitate unified access to document fields. It also handles
102
102
* Document, PackedArray, and Serializable objects.
103
103
*
104
- * PackedArray is intentionally allowed because this function is not used for
105
- * type checking. Prohibiting PackedArray would only require callers to check
106
- * for a PackedArray in order to avoid an exception. Furthermore, this function
107
- * does not distinguish between Serializable::bsonSerialize() return values that
108
- * might encode as a BSON document or array.
104
+ * This function is not used for type checking. Therefore, it does not reject
105
+ * PackedArray objects or Serializable::bsonSerialize() return values that would
106
+ * encode as BSON arrays.
109
107
*
110
108
* @internal
111
109
* @param array|object $document
@@ -127,6 +125,9 @@ function document_to_array($document): array
127
125
}
128
126
129
127
if (is_object ($ document )) {
128
+ /* Note: this omits all uninitialized properties, whereas BSON encoding
129
+ * includes untyped, uninitialized properties. This is acceptable given
130
+ * document_to_array()'s use cases. */
130
131
$ document = get_object_vars ($ document );
131
132
}
132
133
You can’t perform that action at this time.
0 commit comments