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

Некорректно отдается number в стандартизации номера телефона #34

Closed
alexmorbo opened this issue May 16, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@alexmorbo
Copy link
Contributor

Наткнулся на проблему при стандартизации номера телефона.
Если смотреть, что отдает стандартизация от дадаты по номеру телефона, то получаю следующее:

array:12 [
  "source" => "79920073931"
  "type" => "Мобильный"
  "phone" => "+7 992 007-39-31"
  "country_code" => "7"
  "city_code" => "992"
  "number" => "0073931"
  "extension" => null
  "provider" => "ООО "Т2 Мобайл""
  "region" => "Свердловская область"
  "timezone" => "UTC+5"
  "qc_conflict" => 0
  "qc" => 0
]

После того, как ответ от дадаты обрабатывается библиотекой, то получаю следующее:

Dadata\Response\Phone {#83
  +source: "79920073931"
  +type: "Мобильный"
  +phone: "+7 992 007-39-31"
  +country_code: 7
  +city_code: 992
  +number: 73931
  +extension: null
  +provider: "ООО "Т2 Мобайл""
  +region: "Свердловская область"
  +timezone: "UTC+5"
  +qc_conflict: 0
  +qc: 0
}

Как видно, поле number - имеет int'овое значение, нули обрезаются и если обращаться к этому полю, то финальный номер будет некорректен.

Лечится, если привести это поле к string типу

@kstkn kstkn self-assigned this May 16, 2018
@kstkn kstkn added the bug label May 16, 2018
@kstkn kstkn added this to the 1.1.13 milestone May 16, 2018
kstkn pushed a commit that referenced this issue May 16, 2018
kstkn pushed a commit that referenced this issue May 16, 2018
Fix #34 Change Phone::$number type to string
@kstkn kstkn modified the milestones: 1.1.13, 1.1.14 May 16, 2018
@kstkn
Copy link
Owner

kstkn commented May 16, 2018

Thanks, @alexmorbo!
Fixed in version 1.1.14

@kstkn kstkn closed this as completed May 16, 2018
@kstkn
Copy link
Owner

kstkn commented May 16, 2018

Oh, i'm sorry. Tagged wrong branch. 1.1.14 is broken, use 1.1.15
@alexmorbo

@kstkn kstkn modified the milestones: 1.1.14, 1.1.15 May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants