- Issue created by @philsward
PHP 8+ on Commerce for D7 causes some errors on cache flush:
Warning: Trying to access array offset on value of type null in commerce_product_reference_views_data_alter() (line 86 of sites/all/modules/contrib/commerce/modules/product_reference/includes/views/commerce_product_reference.views.inc).
Warning: Trying to access array offset on value of type null in commerce_product_reference_views_data_alter() (line 93 of sites/all/modules/contrib/commerce/modules/product_reference/includes/views/commerce_product_reference.views.inc).
Warning: Trying to access array offset on value of type null in commerce_product_reference_views_data_alter() (line 94 of sites/all/modules/contrib/commerce/modules/product_reference/includes/views/commerce_product_reference.views.inc).
I have no idea what I'm doing, but the following fixed the errors:
Line 86 Fix
- $replacements = array('@entity_type' => $entity_info['label'], '!field_name' => $field['field_name']);
+ $replacements = array('@entity_type' => isset($entity_info['label']), '!field_name' => $field['field_name']);
Line 93 Fix
- 'base' => $entity_info['base table'],
+ 'base' => isset($entity_info['base table']),
Line 94 Fix
- 'base field' => $entity_info['entity keys']['id'],
+ 'base field' => isset($entity_info['entity keys']['id']),
Posting since there are no other references online talking about this.
There's no guarantee this fix won't break something else.
If there's a more elegant fix, please feel free to provide.
Active
1.0
Views integration