tags:

views:

45

answers:

1

Hi everyone,

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?

A: 

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).

Jordan Ryan Moore
Just made the edit you suggested. Seems like a good solution to me and seems to work fine. Thanks a million.
Douglas