IpInfoDb - Uncaught TypeError: Argument 11 passed to Geocoder\Model\Address
Nobody has claimed this yet.
- #1095 by @rtmotiondev — closed without merging
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 25/100
Research direction
Reproduce the IpInfoDb lookup with IP 1.143.27.182 and inspect the timezone conversion around timezone_name_from_abbr(). Confirm the behavior when DST makes the lookup return false, then verify that the resulting Address construction no longer receives a boolean.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- PHP
- Stars
- 4k
- Forks
- 525
- Avg merge
- 8m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from geocoder-php/Geocoder
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
geocoder-php/Geocoder#1272 ·
-
question
Difficulty 4/5 3-5 days Newbie friendliness 25/100
geocoder-php/Geocoder#1267 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
geocoder-php/Geocoder#1266 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 38/100
geocoder-php/Geocoder#1244 · 2 comments · 2 reactions ·
-
provider
Difficulty 4/5 3-5 days Newbie friendliness 30/100
geocoder-php/Geocoder#1243 ·
All issues in geocoder-php/Geocoder
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·