{"action":"created","issue":{"url":"https://api.github.com/repos/giggsey/libphonenumber-for-php/issues/75","labels_url":"https://api.github.com/repos/giggsey/libphonenumber-for-php/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/giggsey/libphonenumber-for-php/issues/75/comments","events_url":"https://api.github.com/repos/giggsey/libphonenumber-for-php/issues/75/events","html_url":"https://github.com/giggsey/libphonenumber-for-php/issues/75","id":95031701,"number":75,"title":"[Feedback wanted] PhoneNumber->__toString() gives misleading data","user":{"login":"giggsey","id":305730,"avatar_url":"https://avatars.githubusercontent.com/u/305730?v=3","gravatar_id":"","url":"https://api.github.com/users/giggsey","html_url":"https://github.com/giggsey","followers_url":"https://api.github.com/users/giggsey/followers","following_url":"https://api.github.com/users/giggsey/following{/other_user}","gists_url":"https://api.github.com/users/giggsey/gists{/gist_id}","starred_url":"https://api.github.com/users/giggsey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giggsey/subscriptions","organizations_url":"https://api.github.com/users/giggsey/orgs","repos_url":"https://api.github.com/users/giggsey/repos","events_url":"https://api.github.com/users/giggsey/events{/privacy}","received_events_url":"https://api.github.com/users/giggsey/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/giggsey/libphonenumber-for-php/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-14T20:24:23Z","updated_at":"2015-09-10T11:15:28Z","closed_at":"2015-08-07T14:20:14Z","body":"The current version of the PHP returns `+[Country Code][National Number]`.\r\n\r\nHowever, this is misleading, as it looks like it's E164. However, for some regions/types of number, this is not valid. For example, the example number of Italy is `+390212345678`, but if you parse this number, then do a `__toString()` on it, it'll actually return `+39212345678` (note the missing 0 after the country code).\r\n\r\nThe Java version of the project does the following:\r\n\r\n```java\r\n    public String toString() {\r\n      StringBuilder outputString = new StringBuilder();\r\n      outputString.append(\"Country Code: \").append(countryCode_);\r\n      outputString.append(\" National Number: \").append(nationalNumber_);\r\n      if (hasItalianLeadingZero() && isItalianLeadingZero()) {\r\n        outputString.append(\" Leading Zero(s): true\");\r\n      }\r\n      if (hasNumberOfLeadingZeros()) {\r\n        outputString.append(\" Number of leading zeros: \").append(numberOfLeadingZeros_);\r\n      }\r\n      if (hasExtension()) {\r\n        outputString.append(\" Extension: \").append(extension_);\r\n      }\r\n      if (hasCountryCodeSource()) {\r\n        outputString.append(\" Country Code Source: \").append(countryCodeSource_);\r\n      }\r\n      if (hasPreferredDomesticCarrierCode()) {\r\n        outputString.append(\" Preferred Domestic Carrier Code: \").\r\n            append(preferredDomesticCarrierCode_);\r\n      }\r\n      return outputString.toString();\r\n    }\r\n```\r\n\r\nFor the example Italian number, this causes the output to be: \r\n> Country Code: 39 National Number: 212345678 Leading Zero(s): true\r\n\r\n\r\nMy question to people who see this is: Should we change the string output to match what the Java version has. The issue has been present since 6fec96dcbea2607407a70d0baf2bbc34196dd625."},"comment":{"url":"https://api.github.com/repos/giggsey/libphonenumber-for-php/issues/comments/139207236","html_url":"https://github.com/giggsey/libphonenumber-for-php/issues/75#issuecomment-139207236","issue_url":"https://api.github.com/repos/giggsey/libphonenumber-for-php/issues/75","id":139207236,"user":{"login":"Rvanlaak","id":2707563,"avatar_url":"https://avatars.githubusercontent.com/u/2707563?v=3","gravatar_id":"","url":"https://api.github.com/users/Rvanlaak","html_url":"https://github.com/Rvanlaak","followers_url":"https://api.github.com/users/Rvanlaak/followers","following_url":"https://api.github.com/users/Rvanlaak/following{/other_user}","gists_url":"https://api.github.com/users/Rvanlaak/gists{/gist_id}","starred_url":"https://api.github.com/users/Rvanlaak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rvanlaak/subscriptions","organizations_url":"https://api.github.com/users/Rvanlaak/orgs","repos_url":"https://api.github.com/users/Rvanlaak/repos","events_url":"https://api.github.com/users/Rvanlaak/events{/privacy}","received_events_url":"https://api.github.com/users/Rvanlaak/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T11:15:28Z","updated_at":"2015-09-10T11:15:28Z","body":"The `composer.json` of PhoneNumberBundle is pinned to `~5.7|~6.0|~7.0` so that also didn't catch that :+1: Where we usually check all upgrade notes, this one slipped through."}}