Recently encountered this bug when running a site localhost on my mac. The IP was ::1 but ip2long was giving me a null value so the generated query was invalid.
|
public static function getFromRequest($create = true) |
|
{ |
|
$sessionData = array( |
|
'LastIP' => !empty($_SERVER['REMOTE_ADDR']) ? ip2long($_SERVER['REMOTE_ADDR']) : null |
|
,'LastRequest' => time() |
|
); |

Considering the architectural challenges with Session data. What do you think about creating a second field for ipv6 addresses?
binary (16) as per this article is suggested: https://medium.com/@richardoosterhof/optimize-php-and-mysql-for-ipv6-daab664962e2