Skip to content

Commit cb6570a

Browse files
committed
PHPC-757: Implement The MongoDB Handshake Protocol
1 parent e7fff8e commit cb6570a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

php_phongo.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,11 +1878,17 @@ PHP_MINIT_FUNCTION(mongodb)
18781878
{
18791879
(void)type; /* We don't care if we are loaded via dl() or extension= */
18801880

1881+
char *php_version_string = malloc(4 + sizeof(MONGODB_VERSION_S) + 1);
18811882

18821883
REGISTER_INI_ENTRIES();
18831884

18841885
/* Initialize libmongoc */
18851886
mongoc_init();
1887+
1888+
/* Set handshake options */
1889+
snprintf(php_version_string, 4 + sizeof(MONGODB_VERSION_S) + 1, "PHP %s", PHP_VERSION);
1890+
mongoc_handshake_data_append("ext-mongodb:PHP", MONGODB_VERSION_S, php_version_string);
1891+
18861892
/* Initialize libbson */
18871893
bson_mem_set_vtable(&MONGODB_G(bsonMemVTable));
18881894

0 commit comments

Comments
 (0)