helpscout / helpscout-api-php

PHP Wrapper for the Help Scout API
MIT License
98 stars 62 forks source link

Conversation thread ID is overflowing int #246

Closed cheesegrits closed 4 years ago

cheesegrits commented 4 years ago

Thank you for taking the time to submit an issue with all the details shown below. Our engineering team monitors issues submitted and strives to respond with 1-2 business days.

Current behavior

Trying to do anything with my conversation threads is blowing up.

Expected behavior

Calling ...

$threads = $client->threads()->list($conversation->getId());

... or doing ...

                $conversationRequest = new ConversationRequest();
                $conversationRequest = $conversationRequest->withThreads();
                $conversations = $client->conversations()->list($filters, $conversationRequest);

... should not blow up.

Steps to reproduce

Because my threads are returning VERY large IDs as floats, like 3488264305.0, when this gets cast to an int in getId() in the Thread.php, it overflows and becomes negative, triggering the ...

Assert::greaterThan($id, 0);

This happens on the very first conversation in the first page, so I'm kinda stuck.

cheesegrits commented 4 years ago

Ah HAH!

Realized it's because I'm running an x86 (32 bit) Apache and PHP, so 3488264305 exceeds the signed int max.

Updated to x64 (64 bit), things now work as expected.

Not sure if it's documented anywhere, but if not, probably should be noted that this SDK requires 64 bit.

bkuhl commented 4 years ago

Hey Hugh,

I'm glad you were able to get this resolved. Thanks for posting the solution here so others can find it.