rsanchez / json

Output ExpressionEngine data in JSON format.
http://devot-ee.com/add-ons/json/
100 stars 236 forks source link

Fixed PHP_INT_MAX issue after casting date integer on a 32-bit system #35

Closed convexstyle closed 10 years ago

convexstyle commented 10 years ago

(int) ($date.'000') returns 2147483647 that is PHP_INT_MAX on a 32-bit system so that I removed integer casting.

For example, on a 32 bit system, it goes to the following. $date = 1367129640; (int) ($date.'000') -> 2147483647 (integer) (int) $date.'000' -> "1367129640000" (string) $date.'000' -> "1367129640000" (string) $date * 1000 -> 1367129640000 (double)

On a 64 bit system, this works as it is.

rsanchez commented 10 years ago

Oh, PHP. Thank you.