Problem/Motivation

NumberFieldTestCase uses non-existing formatter number_float causing:

exception: [Notice] Line 633 of modules/field/field.crud.inc:
Trying to access array offset on value of type null
168    $this->instance = array(
169      'field_name' => $this->field['field_name'],
170     'entity_type' => 'test_entity',
171      'bundle' => 'test_bundle',
172      'widget' => array(
173        'type' => 'number',
174      ),
175      'display' => array(
176        'default' => array(
177          'type' => 'number_float',
178        ),
179      ),
180    );

Proposed resolution

Use number_decimal instead

Remaining tasks

Patch review

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

See the parent issue

CommentFileSizeAuthor
#3 3126133-3.patch473 bytestaran2l

Comments

Taran2L created an issue. See original summary.

taran2l’s picture

Issue summary: View changes
taran2l’s picture

Status: Active » Needs review
StatusFileSize
new473 bytes
taran2l’s picture

Confirmation against the baseline #3081386-70: [META] Fully support PHP 7.4 in Drupal 7:

curl -s https://www.drupal.org/pift-ci-job/1640782 | grep -o 'exception: .* Line [0-9]* of .*:' | perl -pe 's#<.*?>##g' | sort | uniq -c | sort -rn | diff - <(curl -s https://www.drupal.org/pift-ci-job/1643154 | grep -o 'exception: .* Line [0-9]* of .*:' | perl -pe 's#<.*?>##g' | sort | uniq -c | sort -rn)
12d11
<    1 exception: [Notice] Line 633 of modules/field/field.crud.inc:
joseph.olstad’s picture

Status: Needs review » Reviewed & tested by the community

Great work @Taran2L

mcdruid’s picture

Issue tags: +Pending Drupal 7 commit

https://git.drupalcode.org/project/drupal/-/blob/7.x/modules/field/modul...

    'number_float' => array(
      'label' => t('Float'),
      'description' => t('This field stores a number in the database in a floating point format.'),
      'settings' => array('decimal_separator' => '.'),
      'instance_settings' => array('min' => '', 'max' => '', 'prefix' => '', 'suffix' => ''),
      'default_widget' => 'number',
      'default_formatter' => 'number_decimal',
    ),

The number_float field indeed uses number_decimal as its default_formatter.

So yup, this LGTM.

fabianx’s picture

Assigned: Unassigned » mcdruid

RTBM - thanks all!

  • mcdruid committed 9c181e3 on 7.x
    Issue #3126133 by Taran2L: NumberFieldTestCase uses non-existent...
mcdruid’s picture

Assigned: mcdruid » Unassigned
Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit

Thanks everyone!

Status: Fixed » Closed (fixed)

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