@@ -2459,6 +2459,16 @@ static char* php_phongo_manager_make_client_hash(const char* uri_string, zval* o
24592459 return hash ;
24602460}
24612461
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+
24622472static mongoc_client_t * php_phongo_make_mongo_client (const mongoc_uri_t * uri ) /* {{{ */
24632473{
24642474 const char * mongoc_version , * bson_version ;
@@ -2485,6 +2495,8 @@ static mongoc_client_t* php_phongo_make_mongo_client(const mongoc_uri_t* uri) /*
24852495 bson_version ,
24862496 PHP_VERSION );
24872497
2498+ php_phongo_set_handshake_data ();
2499+
24882500 return mongoc_client_new_from_uri (uri );
24892501} /* }}} */
24902502
@@ -3326,21 +3338,13 @@ static zend_class_entry* php_phongo_fetch_internal_class(const char* class_name,
33263338/* {{{ PHP_MINIT_FUNCTION */
33273339PHP_MINIT_FUNCTION (mongodb )
33283340{
3329- char * php_version_string ;
3330-
33313341 (void ) type ; /* We don't care if we are loaded via dl() or extension= */
33323342
33333343 REGISTER_INI_ENTRIES ();
33343344
33353345 /* Initialize libmongoc */
33363346 mongoc_init ();
33373347
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-
33443348 /* Initialize libbson */
33453349 bson_mem_set_vtable (& MONGODB_G (bsonMemVTable ));
33463350
0 commit comments