Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update::replyTo() type hint fails on 32-bit PHP #12

Closed
jsmitty12 opened this issue May 24, 2017 · 1 comment
Closed

Update::replyTo() type hint fails on 32-bit PHP #12

jsmitty12 opened this issue May 24, 2017 · 1 comment

Comments

@jsmitty12
Copy link
Contributor

Twitter message ids are very large, and are too big to be represented by a 32-bit integer. The int type hint on the declaration of \PeeHaa\AsyncTwitter\Api\Request\Status\Update::replyTo() causes a TypeError on 32-bit PHP:

TypeError: Argument 1 passed to PeeHaa\AsyncTwitter\Api\Request\Status\Update::replyTo() must be of the type integer, float given, called in D:\projects\phptek-asynch\twitter-bot.php on line 43 in D:\projects\phptek-asynch\vendor\peehaa\async-twitter\src\Api\Request\Status\Update.php on line 19

Originally I was thinking that this could be avoided by simply removing the type hints, but my testing shows that it won't work because PHP converts the integer to a floating point, losing some precision in the process as show in this partial print_r output of a status update:
Array ( [created_at] => Wed May 24 01:21:10 +0000 2017 [id] => 8.6718869400397E+17 [id_str] => 867188694003974148 )
The only solution is to require 64-bit PHP.

jsmitty12 added a commit to jsmitty12/AsyncTwitter that referenced this issue May 24, 2017
@PeeHaa
Copy link
Owner

PeeHaa commented May 24, 2017

Yes. It was a choice to not support 32 bits systems assuming most people will run 64b anyway.

I could just convert all the overflowing integers to strings.

I am not too attached to keeping it ints if people are actually still running on 32b systems. It's all fine by me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants