Layout builder TypeError: Drupal\phone_international\Helpers\ValidatingService::formatNumber(): Argument #1 ($number) must be of type string, int given

Created on 9 September 2024, 2 months ago
Updated 10 September 2024, 2 months ago

Problem/Motivation

TypeError: Drupal\phone_international\Helpers\ValidatingService::formatNumber(): Argument #1 ($number) must be of type string, int given, called in /var/www/html/web/modules/contrib/phone_international/src/Plugin/Field/FieldType/PhoneInternational.php on line 34 in Drupal\phone_international\Helpers\ValidatingService->formatNumber() (line 48 of modules/contrib/phone_international/src/Helpers/ValidatingService.php).
Drupal\phone_international\Plugin\Field\FieldType\PhoneInternational->preSave() (Line: 233)

Steps to reproduce

I have a paragraph in which this International Phone field available and I am using this paragraph in a content type, In content type manage display teaser view when i click on manage layout then i am getting this error.

Proposed resolution

Using strval() here to ensure that the value passed to formatNumber is always a string
$this->value = \Drupal::service('phone_international.validate')
->formatNumber(strval($this->get('value')->getValue()));

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

3.3

Component

Code

Created by

🇮🇳India Ujjval Kumar Jha

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024