maxmind / GeoIP2-php

PHP API for GeoIP2 webservice client and database reader
https://maxmind.github.io/GeoIP2-php/
Apache License 2.0
2.33k stars 276 forks source link

Timezone ID invalid #35

Closed Daijobou closed 9 years ago

Daijobou commented 9 years ago

One single visitor create this php error report:

date_default_timezone_set(): Timezone ID 'Asia/Tokyo, session_database=1ee2a5f346389b7f02332231e08def84384d5411~54fb28e5cf93a2-08272203' is invalid

The timezone string from geoip_time_zone_by_country_and_region() included the session id separated with a comma ","? How can this happen? Is this a bug in php (5.5.22)?

should be created by this code (short version)

    $result = geoip_record_by_name('180.144.227.111');
    if ($result)
    {           date_default_timezone_set(geoip_time_zone_by_country_and_region($result['country_code'],$result['region']));
    }

I have tested with original code and its working fine for this IP.

oschwald commented 9 years ago

The code you posted uses the GeoIP Legacy API, not this API.