Problem/Motivation

Warning: Undefined array key 0 in Drupal\custom_field\Plugin\CustomField\FieldFormatter\NumericFormatterBase->formatValue() (line 97 of modules/contrib/custom_field/src/Plugin/CustomField/FieldFormatter/NumericFormatterBase.php).
Warning: Trying to access array offset on value of type null in Drupal\custom_field\Plugin\CustomField\FieldFormatter\NumericFormatterBase->formatValue() (line 97 of modules/contrib/custom_field/src/Plugin/CustomField/FieldFormatter/NumericFormatterBase.php).

Steps to reproduce

Versión de Drupal
10.2.6

PHP
Versión
8.1.28

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#6 3452066-6.patch572 bytesapmsooner
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ady1503 created an issue. See original summary.

deepak5423’s picture

@ady1503 Can you please elaborate on the reproducing steps because I cannot?

ady1503’s picture

It is simple.

Just add a number field and that's it.
This error appears when saving the new node also when editing.

And very important:

That the error is repeated for each field number of the custom_field in the same content type.

I also saw a strange thing.

When you create a new content type and save it, the keys appear and not the values. But if you go to Manage Presentation and simply change the presentation to key in any number field and save, all the number fields show the value and the one you changed shows the key, and then you put it back to value, everything is normal. You have to repeat this matter if you have added another number field, so that all the number fields present the values ​​and not the keys.

These errors appear only the first time when creating a new content type. Then they no longer appear.

Create a new content type, add a custom_field of number format.

Create the first one, and you will see the error, edit it and the error appears. But the following new ones created and edited no longer appear.

Gracias.

apmsooner made their first commit to this issue’s fork.

apmsooner’s picture

StatusFileSize
new572 bytes

@ady1503, This patch should fix if you would kindly test. Thanks

apmsooner’s picture

Version: 3.0.0-rc3 » 3.0.x-dev
Status: Active » Needs review
jonasanne’s picture

I tested this on 10.2.6 with php 8.1 (branch 2.0.x and branch 3.0.x) and on 10.3.0 with 8.3 while following the steps above and I do not have the error.

  • apmsooner committed cf308e2e on 3.0.x
    Issue #3452066 by apmsooner, Jonasanne: Errors and not saving all data...
apmsooner’s picture

Status: Needs review » Fixed
ady1503’s picture

I confirm all working.

Thanks for this module.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.