Skip to content

Commit 29627f0

Browse files
committed
fix(agent): expand scope of if statement for func->common.scope check
1 parent dd22e39 commit 29627f0

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

agent/lib_aws_sdk_php.c

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -545,35 +545,34 @@ void nr_lib_aws_sdk_php_dynamodb_set_params(
545545

546546
if (NULL != func->common.scope) {
547547
base_class = func->common.scope;
548-
}
549548

550-
region_zval = nr_php_get_zval_object_property_with_class(this_obj, base_class,
551-
"region");
552-
if (nr_php_is_zval_non_empty_string(region_zval)) {
553-
cloud_attrs->cloud_region = Z_STRVAL_P(region_zval);
554-
}
555-
556-
endpoint_zval = nr_php_get_zval_object_property_with_class(
557-
this_obj, base_class, "endpoint");
558-
if (nr_php_is_zval_valid_object(endpoint_zval)) {
559-
host_zval = nr_php_get_zval_object_property(endpoint_zval, "host");
560-
if (nr_php_is_zval_non_empty_string(host_zval)) {
561-
datastore_params->instance->host = Z_STRVAL_P(host_zval);
562-
563-
/* Only try to get a port if we have a valid host. */
564-
port_zval = nr_php_get_zval_object_property(endpoint_zval, "port");
565-
if (nr_php_is_zval_valid_integer(port_zval)) {
566-
/* Must be freed by caller */
567-
datastore_params->instance->port_path_or_id
568-
= nr_formatf(NR_INT64_FMT, Z_LVAL_P(port_zval));
569-
} else {
570-
/* In case where host was found but port was not, spec says return
571-
* unknown for port. */
572-
datastore_params->instance->port_path_or_id = nr_strdup("unknown");
549+
region_zval = nr_php_get_zval_object_property_with_class(
550+
this_obj, base_class, "region");
551+
if (nr_php_is_zval_non_empty_string(region_zval)) {
552+
cloud_attrs->cloud_region = Z_STRVAL_P(region_zval);
553+
}
554+
555+
endpoint_zval = nr_php_get_zval_object_property_with_class(
556+
this_obj, base_class, "endpoint");
557+
if (nr_php_is_zval_valid_object(endpoint_zval)) {
558+
host_zval = nr_php_get_zval_object_property(endpoint_zval, "host");
559+
if (nr_php_is_zval_non_empty_string(host_zval)) {
560+
datastore_params->instance->host = Z_STRVAL_P(host_zval);
561+
562+
/* Only try to get a port if we have a valid host. */
563+
port_zval = nr_php_get_zval_object_property(endpoint_zval, "port");
564+
if (nr_php_is_zval_valid_integer(port_zval)) {
565+
/* Must be freed by caller */
566+
datastore_params->instance->port_path_or_id
567+
= nr_formatf(NR_INT64_FMT, Z_LVAL_P(port_zval));
568+
} else {
569+
/* In case where host was found but port was not, spec says return
570+
* unknown for port. */
571+
datastore_params->instance->port_path_or_id = nr_strdup("unknown");
572+
}
573573
}
574574
}
575575
}
576-
577576
if (NULL == datastore_params->instance->host) {
578577
/* Unable to retrieve the endpoint, go with AWS defaults. */
579578
datastore_params->instance->host = AWS_SDK_PHP_DYNAMODBCLIENT_DEFAULT_HOST;

0 commit comments

Comments
 (0)