There are some notices and warnings in a case there is no "value" key in the $values here \Drupal\tablefield\Plugin\Field\FieldType\TablefieldItem::setValue

Warning: Invalid argument supplied for foreach() in Drupal\tablefield\Plugin\Field\FieldType\TablefieldItem->setValue() (line 190

Notice: Undefined index: value in Drupal\tablefield\Plugin\Field\FieldType\TablefieldItem->setValue() (line 190

Comments

nikita_tt created an issue. See original summary.

nikita_tt’s picture

Status: Active » Needs review
Related issues: +#3020601: PHP 7.2 notices/warnings in TablefieldItem.php
StatusFileSize
new1.07 KB
aslaymoore’s picture

Tested on Drupal 9.2.9, PHP 7.4, and the patch fixed the warnings for me. Tablefield also still works as expected.

+1 RTBC

lolandese’s picture

Status: Needs review » Reviewed & tested by the community

Changing status to RTBC based on:

  • comment #3 on D9
  • passing the automated test on D8
  • the added code line makes sense and is simple enough to not trigger unexpected behaviour.

  • lolandese committed b501445 on 8.x-2.x authored by nikita_tt
    Issue #3174287 by nikita_tt, azslay: Notices and Warnings in...
lolandese’s picture

Status: Reviewed & tested by the community » Fixed
martin@martin-XPS-13-9370 /var/www/html/brown.localhost/web/modules/contrib/tablefield (8.x-2.x=) $ git apply -v tablefield-3174287-php_notices-1-D8.patch
Checking patch src/Plugin/Field/FieldType/TablefieldItem.php...
Applied patch src/Plugin/Field/FieldType/TablefieldItem.php cleanly.

Status: Fixed » Closed (fixed)

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