Fix ip2long() behavior to be compatible with PHP5.

Fixes #2209.