elastic / elastic/apm-agent-php

InternalFailureException: Unexpected value type

Open
#742 0 comments 1 reaction 0 assignees View on GitHub
agent-php bug priority: high triaged
Dominant language
PHP
Stars
268
Forks
86
PR merge metrics
No merged PRs in 30d

Description

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`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.