Hello!
I just installed today Nextcloud on our server and on the user profile it is impossible to save phone numbers. Nextcloud send the error message:
“Unable to set invalid phone number✖ ”
It doesn’t seem to matter how you configure the format of the phone number. The software just rejects it.
This issue has also been reported here by another user:
Nextcloud version: 21.0.0
Operating system and version: Linux 5.10.21-Unraid 6.9.1
nginx version: 2018/08/16
PHP version: 7.4.15
The issue you are facing: I’m trying to input my phone number into the profile page for my user profile and no matter what format I input the phone number in, I get an error that says “Unable to set invalid phone number”. Nothing else is shown in the server logs. This is a brand new install on an Unraid server using the linuxserver Docker image.
Is this the first …
I hope someone here could help me in the right direction on how to solve this issue.
Thank you very much in advance.
Kind regards
Hmm…
Anyone here that maybe could help me out with this please?
Kind regards
AngryWarrior
tflidd
April 10, 2021, 1:52pm
3
Well, there is a related bug report, unless there is more information or a fix, there is not much we can do here. Ref:
opened 02:30PM - 04 Mar 21 UTC
closed 12:38PM - 12 Apr 21 UTC
bug
0. Needs triage
### Steps to reproduce
1. Install Nextcloud 21.0.0
2. try to set user phone nu… mberin profile
### Expected behaviour
It should save the phone number.
### Actual behaviour
Error Message: Ungültige Telefonnummer kann nicht festgelegt werden
I used 017612345678 as a phone number...
then 0049712345678
then +49123456789
it all didn't work...
![image](https://user-images.githubusercontent.com/19840345/109978763-816eed00-7cfe-11eb-8ffc-5266948c052b.png)
### Server configuration
cloud server - installed via the nextcloud_production_install.sh script.
postgres / php 7.4 on ubuntu 20.04, 2 cpu's 4GB RAM
Hi @AngryWarrior
did you configure the default_phone_region
setting in your config.php
as suggested by the Admin overview page suggestions?
/S
1 Like
This setting came out of nowhere for me after upgrading to 21.0.1
Been so long since I looked at the Admin overview pages I’m going to have to find them again.
Hi.
No we haven’t done that, (yet ). But will that not also limit the phone field to accept one county?
We have employees from several different countries so it must accept different formats.
I’ve been digging a bit in the code and it looks like
the field only accepts phone numbers with country code (starting with +
that is) if no default_phone_region
is configured
the field only accepts phone numbers from the configured region if the default_phone_region
is configured.
That’s quite a bummer and I would consider this a bug that should be reported on Github.
/S
1 Like
PS: the relevant code is this here:
/**
* @param string $input
* @return string Provided phone number in E.164 format when it was a valid number
* @throws \InvalidArgumentException When the phone number was invalid or no default region is set and the number doesn't start with a country code
*/
protected function parsePhoneNumber(string $input): string {
$defaultRegion = $this->config->getSystemValueString('default_phone_region', '');
if ($defaultRegion === '') {
// When no default region is set, only +49… numbers are valid
if (strpos($input, '+') !== 0) {
throw new \InvalidArgumentException(self::PROPERTY_PHONE);
}
$defaultRegion = 'EN';
}
$phoneUtil = PhoneNumberUtil::getInstance();
try {
$phoneNumber = $phoneUtil->parse($input, $defaultRegion);
This file has been truncated. show original
1 Like
I agree.
This is indeed a bummer and quite counter productive thing. (Since the normal mode doesn’t work ).
Thanks for looking into this @simonspa .
I guess there is not so much that can be done here.
The Nextcloud dev team needs to fix this bug (?) and until then we can only wait for it to happen, right?
As @nickvergessen pointed out, it actually accepts any international (valid!) number in addition to the local number of the configured region - this seems to work for me, could you confirm?
1 Like
@simonspa thanks again.
I’ve added the setting and will test it shortly.
Kind regards
Confirmed.
That work-around actually does the trick. I’ve tested and it works too.
Still the faulty default mode is something I think should be considered as a bug though and hopefully be fixed in a never version. Right?
Just my 5 cents.
The phone string syntax is important and this may be what is causing consternation after updating the config with your phone zone.
Example for US:
WORKS: +13721231234
DOES NOT WORK: 3721231234
phone region has to be in capital letter
‘default_phone_region’ => ‘FR’,
how come this kind of settings can’t be set through the User Interface ?