开发者

PHP-Twitter and Issues with showStatus()

I'm using php-twitter (Billingham et al) to fiddle with the Twitter API and came up against a wall in terms of using the showStatus function. Most of the time it wasn't showing any status 开发者_如何学运维and, when it did, it showed the wrong statues. After much banging of the head against the wall, I discovered that my problem was that the call to intval() actually altered the values I was placing in the showStatus $id parameter. Removing intval() from the function seems to have fixed the problem up to this point.

Has anyone else come across this problem? I'm a bit nervous about making the alteration, is this the best way to go about it?


The reason that intval() is causing this problem is because Twitter status ID's have passed the maximum value for a 32-bit integer. The maximum value of a signed 32-bit intger is 2,147,483,648, and the maximum for an unsigned 32-bit integer is 4,294,967,295.

I don't know the specifics of the library you're using, but I would replace the use of intval() with another function to filter out non-numeric characters. I would consider using filter_var($id, FILTER_SANITIZE_NUMBER_INT).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜