File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2777,7 +2777,15 @@ PHP_FUNCTION(DDTrace_add_endpoint) {
27772777 struct ddog_Vec_CharSlice * request_body_type_vec = ddog_CharSlice_to_owned (dd_zend_string_to_CharSlice (request_body_type ));
27782778 struct ddog_Vec_CharSlice * response_body_type_vec = ddog_CharSlice_to_owned (dd_zend_string_to_CharSlice (response_body_type ));
27792779 struct ddog_Vec_Authentication * authentication_vec = ddog_number_to_owned_Authentication (authentication );
2780- ddog_CharSlice metadata_slice = dd_zend_string_to_CharSlice (metadata );
2780+
2781+ size_t len = ZSTR_LEN (metadata );
2782+ zend_string * metadata_utf8 = NULL ;
2783+ ddog_CharSlice metadata_slice = {0 };
2784+ char * stripped_utf8 = ddtrace_strip_invalid_utf8 (ZSTR_VAL (metadata ), & len );
2785+ if (stripped_utf8 != NULL && len > 0 ) {
2786+ metadata_utf8 = zend_string_init (stripped_utf8 , len , 0 );
2787+ metadata_slice = dd_zend_string_to_CharSlice (metadata_utf8 );
2788+ }
27812789
27822790 if (!ddtrace_sidecar || !ddtrace_sidecar_instance_id || !DDTRACE_G (sidecar_queue_id )) {
27832791 RETURN_FALSE ;
You can’t perform that action at this time.
0 commit comments