Skip to content

Commit e85f2c5

Browse files
committed
fix: guard against missing input key in Attributes::extractSwatchType
Attributes configured with `frontend_input` instead of `input` (e.g. the `rrp` and `colour` samples) have no `input` key in their config array. PHP 8 raises "Undefined array key" at the bare array access on line 142. Replace with `$attributeConfig['input'] ?? ''` so the swatch check degrades gracefully for those attributes.
1 parent 8027841 commit e85f2c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Component/Attributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private function handleExistingAttribute(mixed $attributeCode, array $attributeA
139139
*/
140140
private function extractSwatchType(array &$attributeConfig): string|false
141141
{
142-
if (!in_array($attributeConfig['input'], ['swatch_text', 'swatch_visual'])) {
142+
if (!in_array($attributeConfig['input'] ?? '', ['swatch_text', 'swatch_visual'])) {
143143
return false;
144144
}
145145

0 commit comments

Comments
 (0)