geocoder-php / geocoder-php/Geocoder

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

未关闭
#1,094 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

  • #1095 来自 @rtmotiondev —— 已关闭,未合并
bug provider
主要语言
PHP
星标
4k
派生
525
平均合并
8 分钟
30 天内合并 PR
1

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用 IP 1.143.27.182 重现 IpInfoDb 查询,并检查 timezone_name_from_abbr() 附近的时区转换。确认 DST 导致查询返回 false 时的行为,然后验证生成的 Address 构造不再接收 boolean 值。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
backend
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。