giggsey / libphonenumber-for-php

PHP version of Google's phone number handling library
https://giggsey.com/libphonenumber/
Apache License 2.0
4.76k stars 468 forks source link

Problem with trimming zeros #578

Closed murat11 closed 1 year ago

murat11 commented 1 year ago

Many phone numbers have leading zeros after the country code. Ivory Coast for example https://www.wikiwand.com/en/Telephone_numbers_in_Ivory_Coast

But this code removes it from resulting number https://github.com/giggsey/libphonenumber-for-php/blob/218caeeeb224bf2f553597b5c3a1647ff936db64/src/PhoneNumberUtil.php#L1799

giggsey commented 1 year ago

Doesn't static::setItalianLeadingZerosForPhoneNumber($normalizedNationalNumber, $phoneNumber); deal with that?

On Tue, 30 May 2023, 16:29 Murat Erkenov, @.***> wrote:

Many phone numbers have leading zeros after the country code. Ivory Coast for example https://www.wikiwand.com/en/Telephone_numbers_in_Ivory_Coast

But this code removes it from resulting number

https://github.com/giggsey/libphonenumber-for-php/blob/218caeeeb224bf2f553597b5c3a1647ff936db64/src/PhoneNumberUtil.php#L1799

— Reply to this email directly, view it on GitHub https://github.com/giggsey/libphonenumber-for-php/issues/578, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACKUQQVNA47ME2BCJY4BDTXIYG5XANCNFSM6AAAAAAYUF73KA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

murat11 commented 1 year ago

As I can see it does not work. Maybe that util instance must be configured in some special way image

giggsey commented 1 year ago

Doesn't that debug show it working?

The $phoneNumber object has italianLeadingZero set to true, and the numberOfItalianZeros is set to 1.