Closed redlumtn1 closed 7 months ago
Looks like you are probably going over max int or something? Notice the value being provided is negative. If you’re pulling from a DB check the structure and use a larger storage like a big int, unsigned.
@JonLaliberte thank you for replying. Currently I'm stating conversation number manually within code (will ammed example) although idea is to pull from db later.
Examples $conversation_no = 581800; - this generates error Got: -2147424636 $conversation_no = 513938; - this is as expected
Both are valid conversations with no discernible difference between them in terms of type (both closed, no tags,not merged). It also seems like the issue is more liekly with newer conversation numbers.
@redlumtn1 we've been investigating your issue, but we cannot replicate it, even with much bigger conversation numbers...
Looking at your error, with a negative number as the ID, it does look like there's a problem with the maximum integer your system can handle. In 32-bit systems, the maximum integer allowed is 2_147_483_647, and if you try to handle numbers bigger than that, you will get unexpected results. Recent conversations may have IDs bigger than that, and the fact that you're still in v2 of this SDK suggests that you may be using an old system, which is probably 32-bit? If that's the case, that's a platform/OS problem and PHP can't do anything about it. You should get a 64-bit platform/OS, where PHP_INT_MAX
is a lot bigger (around 9e18), and things should work for you...
Current behavior Trying to get a conversation ID based on the conversation number (which is known) in order to be able to construct a URL.
Depending on the conversation number this works as expected but some conversations (particularly more recent ones) give the below exception:
HelpScout\Api\Exception\InvalidArgumentException: Expected a value greater than 0. Got: -2106667089 in vendor\helpscout\api\src\Assert\Assert.php:19 Stack trace: #0 vendor\webmozart\assert\src\Assert.php(545): HelpScout\Api\Assert\Assert::reportInvalidArgument('Expected a valu...') #1 vendor\helpscout\api\src\Conversations\Conversation.php(398): Webmozart\Assert\Assert::greaterThan(-2106667089, 0) #2 vendor\helpscout\api\src\Conversations\Conversation.php(172): HelpScout\Api\Conversations\Conversation->setId(-2106667089) #3 vendor\helpscout\api\src\Http\Hal\HalDeserializer.php(37): HelpScout\Api\Conversations\Conversation->hydrate(Array, Array) #4 vendor\helpscout\api\src\Http\Hal\HalDeserializer.php(49): HelpScout\Api\Http\Hal\HalDeserializer::deserializeResource('HelpScout\Api\C...', Object(HelpScout\Api\Http\Hal\HalDocument)) #5 [internal function]: HelpScout\Api\Http\Hal\HalDeserializer::HelpScout\Api\Http\Hal{closure}(Object(HelpScout\Api\Http\Hal\HalDocument)) #6 vendor\helpscout\api\src\Http\Hal\HalDeserializer.php(50): array_map(Object(Closure), Array) #7 vendor\helpscout\api\src\Http\RestClient.php(156): HelpScout\Api\Http\Hal\HalDeserializer::deserializeResources('HelpScout\Api\C...', 'conversations', Object(HelpScout\Api\Http\Hal\HalDocument)) #8 vendor\helpscout\api\src\Conversations\ConversationsEndpoint.php(122): HelpScout\Api\Http\RestClient->getResources('HelpScout\Api\C...', 'conversations', '/v2/conversatio...') #9 vendor\helpscout\api\src\Conversations\ConversationsEndpoint.php(112): HelpScout\Api\Conversations\ConversationsEndpoint->loadConversations('/v2/conversatio...', Object(HelpScout\Api\Conversations\ConversationRequest)) #10 Frontend\office\OPE\helpscout\helpScout_test.php(33): HelpScout\Api\Conversations\ConversationsEndpoint->list(Object(HelpScout\Api\Conversations\ConversationFilters)) #11 {main}