newism / craft3-fields

Address, telephone, email, embed and gender fields for CraftCMS 3.x
Other
54 stars 16 forks source link

Telephone field causes a PHP error when entry is saved #18

Closed romainpoirier closed 6 years ago

romainpoirier commented 6 years ago
PHP Fatal Error – yii\base\ErrorException
Method newism\fields\models\TelephoneModel::__toString() must not throw an exception, caught TypeError: Argument 1 passed to libphonenumber\PhoneNumberUtil::format() must be an instance of libphonenumber\PhoneNumber, null given, called in /vendor/newism/craft3-fields/src/models/TelephoneModel.php on line 66

This happens whatever the phone prefix or phone number, even if empty.

Craft CMS version : 3.0.0-RC7.1

mikestecker commented 6 years ago

Came to report the same issue:

Method newism\fields\models\TelephoneModel::__toString() must not throw an exception, caught TypeError: Argument 1 passed to libphonenumber\PhoneNumberUtil::format() must be an instance of libphonenumber\PhoneNumber, null given

Craft 3.0 RC7.1 as well...

mikestecker commented 6 years ago

After updating to RC8 today the issue still exists

leevigraham commented 6 years ago

@mikestecker @romainpoirier I'll check this out tomorrow. It's my birthday today 😃

mikestecker commented 6 years ago

@leevigraham Happy Birthday! Hope you have a great one!

romainpoirier commented 6 years ago

@leevigraham Happy Birthday 🎂 ! Thank you!

E2design commented 6 years ago

Same issue here on 3.0.0-RC8

Method newism\fields\models\TelephoneModel::__toString() must not throw an exception, caught TypeError: Argument 1 passed to libphonenumber\PhoneNumberUtil::format() must be an instance of libphonenumber\PhoneNumber, null given, called in /storage/av04180/www/thetag_html/vendor/newism/craft3-fields/src/models/TelephoneModel.php on line 66

leevigraham commented 6 years ago

v0.0.8 should fix the issue.