Skip to content

Commit

Permalink
fix(agent): Don't send only major version to vm package
Browse files Browse the repository at this point in the history
Guzzle 7+ was sending only the major version to the vm package
If only major version is available, it should not be sent.
  • Loading branch information
zsistla committed May 22, 2024
1 parent 42136bb commit 2f4bd0e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions agent/lib_guzzle6.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,20 @@ NR_PHP_WRAPPER_START(nr_guzzle6_client_construct) {
zval* this_var = nr_php_scope_get(NR_EXECUTE_ORIG_ARGS);

char* version = nr_php_get_object_constant(this_var, "VERSION");
if (NULL == version) {
version = nr_php_get_object_constant(this_var, "MAJOR_VERSION");
}

if (NRINI(vulnerability_management_package_detection_enabled)) {
// Add php package to transaction
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
}

/*
* If we were unable to get the full version before, at least we can extract
* the major version to send to the supportability metric.
* This is relevant to guzzle7+ which no longer supplies full version.
*/
if (NULL == version) {
version = nr_php_get_object_constant(this_var, "MAJOR_VERSION");
}
nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
version);
nr_free(version);
Expand Down

0 comments on commit 2f4bd0e

Please sign in to comment.