Skip to content

Commit 268c28b

Browse files
committed
fix(agent): It's actually fine if version is null
reverting a portion of previous PR feedback. It's okay if version remains null, the package function will then set it to library known, version unknown.
1 parent 3fa60ec commit 268c28b

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

agent/lib_php_amqplib.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,19 @@ void nr_php_amqplib_handle_version() {
126126
&retval_zpd, "Get nr_php_amqplib_version");
127127

128128
/* See if we got a non-empty/non-null string for version. */
129-
if (FAILURE == result) {
130-
return;
129+
if (SUCCESS == result) {
130+
if (nr_php_is_zval_valid_string(&retval_zpd)) {
131+
version = Z_STRVAL(retval_zpd);
132+
}
131133
}
132134

133-
if (nr_php_is_zval_valid_string(&retval_zpd)) {
134-
version = Z_STRVAL(retval_zpd);
135+
if (NRINI(vulnerability_management_package_detection_enabled)) {
136+
/* Add php package to transaction */
137+
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
135138
}
136139

137-
if (NULL != version) {
138-
if (NRINI(vulnerability_management_package_detection_enabled)) {
139-
/* Add php package to transaction */
140-
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
141-
}
142-
143-
nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
144-
version);
145-
}
140+
nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
141+
version);
146142

147143
zval_dtor(&retval_zpd);
148144
}
@@ -789,6 +785,8 @@ NR_PHP_WRAPPER(nr_rabbitmq_basic_get) {
789785
* want to strdup everything if we don't have to. RabbitMQ basic_get PHP 7.x
790786
* will only strdup server_address and destination_name.
791787
*/
788+
// amber make these peristent for all since retval of null clears the values
789+
// from the cxn
792790
UNDO_PERSISTENCE(message_params.server_address);
793791
UNDO_PERSISTENCE(message_params.destination_name);
794792
}

0 commit comments

Comments
 (0)