Errors and not saving all data to fields

Created on 2 June 2024, 7 months ago
Updated 21 July 2024, 5 months ago

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

๐Ÿ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

๐Ÿ‡ช๐Ÿ‡ธSpain ady1503

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

Merge Requests

Comments & Activities

  • Issue created by @ady1503
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia deepak5423

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

  • ๐Ÿ‡ช๐Ÿ‡ธSpain ady1503

    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.

  • First commit to issue fork.
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States apmsooner

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

  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States apmsooner
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Jonasanne

    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.

  • Pipeline finished with Skipped
    6 months ago
    #217069
  • Status changed to Fixed 6 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States apmsooner
  • ๐Ÿ‡ช๐Ÿ‡ธSpain ady1503

    I confirm all working.

    Thanks for this module.

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

Production build 0.71.5 2024