Skip to content

Commit 68046f3

Browse files
authored
fix(agent): Don't send only major version to vm package (#904)
Guzzle 7+ was sending only the major version to the vm package If only major version is available, it should not be sent. However, we can still use major version for the supportability metric.
1 parent 8ff820d commit 68046f3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

agent/lib_guzzle6.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,20 @@ NR_PHP_WRAPPER_START(nr_guzzle6_client_construct) {
352352
zval* this_var = nr_php_scope_get(NR_EXECUTE_ORIG_ARGS);
353353

354354
char* version = nr_php_get_object_constant(this_var, "VERSION");
355-
if (NULL == version) {
356-
version = nr_php_get_object_constant(this_var, "MAJOR_VERSION");
357-
}
358355

359356
if (NRINI(vulnerability_management_package_detection_enabled)) {
360357
// Add php package to transaction
361358
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
362359
}
360+
361+
/*
362+
* If we were unable to get the full version before, at least we can extract
363+
* the major version to send to the supportability metric.
364+
* This is relevant to guzzle7+ which no longer supplies full version.
365+
*/
366+
if (NULL == version) {
367+
version = nr_php_get_object_constant(this_var, "MAJOR_VERSION");
368+
}
363369
nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
364370
version);
365371
nr_free(version);

0 commit comments

Comments
 (0)