Fix ip2long() behavior to be compatiable with PHP5.

Fixes #2209.