@@ -2459,6 +2459,16 @@ static char* php_phongo_manager_make_client_hash(const char* uri_string, zval* o
2459
2459
return hash ;
2460
2460
}
2461
2461
2462
+ static void php_phongo_set_handshake_data ()
2463
+ {
2464
+ char * php_version_string = malloc (4 + sizeof (PHP_VERSION ) + 1 );
2465
+
2466
+ snprintf (php_version_string , 4 + sizeof (PHP_VERSION ) + 1 , "PHP %s" , PHP_VERSION );
2467
+ mongoc_handshake_data_append ("ext-mongodb:PHP" , PHP_MONGODB_VERSION , php_version_string );
2468
+
2469
+ free (php_version_string );
2470
+ }
2471
+
2462
2472
static mongoc_client_t * php_phongo_make_mongo_client (const mongoc_uri_t * uri ) /* {{{ */
2463
2473
{
2464
2474
const char * mongoc_version , * bson_version ;
@@ -2485,6 +2495,8 @@ static mongoc_client_t* php_phongo_make_mongo_client(const mongoc_uri_t* uri) /*
2485
2495
bson_version ,
2486
2496
PHP_VERSION );
2487
2497
2498
+ php_phongo_set_handshake_data ();
2499
+
2488
2500
return mongoc_client_new_from_uri (uri );
2489
2501
} /* }}} */
2490
2502
@@ -3326,21 +3338,13 @@ static zend_class_entry* php_phongo_fetch_internal_class(const char* class_name,
3326
3338
/* {{{ PHP_MINIT_FUNCTION */
3327
3339
PHP_MINIT_FUNCTION (mongodb )
3328
3340
{
3329
- char * php_version_string ;
3330
-
3331
3341
(void ) type ; /* We don't care if we are loaded via dl() or extension= */
3332
3342
3333
3343
REGISTER_INI_ENTRIES ();
3334
3344
3335
3345
/* Initialize libmongoc */
3336
3346
mongoc_init ();
3337
3347
3338
- /* Set handshake options */
3339
- php_version_string = malloc (4 + sizeof (PHP_VERSION ) + 1 );
3340
- snprintf (php_version_string , 4 + sizeof (PHP_VERSION ) + 1 , "PHP %s" , PHP_VERSION );
3341
- mongoc_handshake_data_append ("ext-mongodb:PHP" , PHP_MONGODB_VERSION , php_version_string );
3342
- free (php_version_string );
3343
-
3344
3348
/* Initialize libbson */
3345
3349
bson_mem_set_vtable (& MONGODB_G (bsonMemVTable ));
3346
3350
0 commit comments