Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IpInfoDb - Uncaught TypeError: Argument 11 passed to Geocoder\Model\Address #1094

Open
rtiagom opened this issue Nov 26, 2020 · 2 comments
Open

Comments

@rtiagom
Copy link
Contributor

rtiagom commented Nov 26, 2020

While testing IpInfoDb with IP 1.143.27.182 I got Uncaught TypeError: Argument 11 passed to Geocoder\Model\Address::__construct() must be of the type string or null, bool given

IpInfoDB response:

  'statusCode' => string 'OK' (length=2)
  'statusMessage' => string '' (length=0)
  'ipAddress' => string '1.143.27.182' (length=12)
  'countryCode' => string 'AU' (length=2)
  'countryName' => string 'Australia' (length=9)
  'regionName' => string 'Victoria' (length=8)
  'cityName' => string 'Geelong' (length=7)
  'zipCode' => string '3220' (length=4)
  'latitude' => string '-38.1471' (length=8)
  'longitude' => string '144.361' (length=7)
  'timeZone' => string '+11:00' (length=6)

$timezone = timezone_name_from_abbr('', (int) substr($data['timeZone'], 0, strpos($data['timeZone'], ':')) * 3600, 0);
timezone_name_from_abbr('', 39600, 0) // Melbourne Australia is observing DST so this does not work

The proper fix is to handle DST time or at the very minimum handle the case of timezone returning false which breaks Geocoder\Model\Address.

@jbelien
Copy link
Member

jbelien commented Nov 26, 2020

Hello @rtiagom ,
Thanks for the notice.

Would you have time to submit a PR ?

@rtiagom
Copy link
Contributor Author

rtiagom commented Nov 27, 2020

@jbelien Sure, I try to submit a PR this weekend.

@jbelien jbelien linked a pull request Nov 29, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants