Array to string conversion error
Opened this issue · 6 comments
\Zendesk\API\Debug::__toString()
$this->lastResponseHeaders
and $this->lastRequestHeaders
are arrays so method fails.
Also have this problem. Temporary quick fix for me is to use json_encode
on Debug
object instead of type casting to string.
Hi there @mtk3d,
Thank you for your contribution. Happy you found a way around this.
I can't replicate this issue:
$tickets = $client->tickets()->findAll(); // First page only
$client->getDebug()->lastResponseHeaders;
= [
"Date" => [
"Tue, 30 Apr 2024 22:36:08 GMT",
],
"Content-Type" => [
"application/json; charset=utf-8",
],
// etc..
Could you please provide a more complete example that's easier to reproduce?
Hi, of course 😄
The problem is when I'm trying to cast Debug object to string. Debug object has _toString()
magic method, so I should be able to cast it to a string like this:
$debugContent = (string) $client->getDebug();
The problem is, that inside _toString()
there is a concatination of lastResponseHeaders
param with a string. In this case, PHP is trying to cast it to the string also, but lastResponseHeaders
contains an array of headers, and it's not possible to directly cast it to a string.
Just a little update that I don't have an update yet, but we haven't forgotten, please bear with us. This doesn't sound blocking, but let us know if it's a big issue.
Thanks for update! Yes that's right, it's non-blocking issue