Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit f792591

Browse files
committed
HHVM-169: Always encode ODS field when serializing Persistable documents
1 parent a12568e commit f792591

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

bson.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -397,16 +397,14 @@ void VariantToBsonConverter::_convertSerializable(bson_t *bson, const char *key,
397397
/* Convert to array so that we can handle it well */
398398
properties = result.toArray();
399399

400-
if (m_level > 0 || (m_flags & HIPPO_BSON_NO_ROOT_ODS) == 0) {
401-
if (v.instanceof(s_MongoDriverBsonPersistable_className)) {
402-
const char *class_name = cls->nameStr().c_str();
403-
Object obj = createMongoBsonBinaryObject(
404-
(const uint8_t *) class_name,
405-
strlen(class_name),
406-
(bson_subtype_t) 0x80
407-
);
408-
properties.add(String(s_MongoDriverBsonODM_fieldName), obj);
409-
}
400+
if (v.instanceof(s_MongoDriverBsonPersistable_className)) {
401+
const char *class_name = cls->nameStr().c_str();
402+
Object obj = createMongoBsonBinaryObject(
403+
(const uint8_t *) class_name,
404+
strlen(class_name),
405+
(bson_subtype_t) 0x80
406+
);
407+
properties.add(String(s_MongoDriverBsonODM_fieldName), obj);
410408
}
411409

412410
convertDocument(bson, key, result.isObject() ? Variant(Variant(properties).toObject()) : Variant(properties));

bson.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ namespace HPHP {
2828
#define HIPPO_BSON_NO_FLAGS 0x00
2929
#define HIPPO_BSON_ADD_ID 0x01
3030
#define HIPPO_BSON_RETURN_ID 0x02
31-
#define HIPPO_BSON_NO_ROOT_ODS 0x04
3231

3332
/* This is not a bitfield */
3433
#define HIPPO_TYPEMAP_DEFAULT 0x03

0 commit comments

Comments
 (0)