apm-agent-php icon indicating copy to clipboard operation
apm-agent-php copied to clipboard

InternalFailureException: Unexpected value type

Open JoniJnm opened this issue 3 years ago • 0 comments

When php-curl-class sets CURLOPT_CUSTOMREQUEST to null:

https://github.com/php-curl-class/php-curl-class/blob/57745cabd6077c2f4ac7fed837e246d83e18ec74/src/Curl/Curl.php#L754

CurlHandleTracker checks if the value of CURLOPT_CUSTOMREQUEST is a string:

https://github.com/elastic/apm-agent-php/blob/a457869b0c15e95b61a41bd75da7208a64b18c94/src/ElasticApm/Impl/AutoInstrument/CurlHandleTracker.php#L350-L352

Becase of it's null the agent throws an error:

InternalFailureException: Unexpected value type. {
    "expectedType": "string",
    "actualType": "NULL"
    ...
}

PHP provides the function curl_setopt but there isn't a unset function, so setting null is the only way

CURLOPT_CUSTOMREQUEST (and maybe other options) should be string|null instead of string

JoniJnm avatar Aug 02 '22 11:08 JoniJnm