Fix: Prevent invalid foreach() on extrafields label in product/price.php

- Ensured $extralabels is always an array before looping to prevent warnings.
- Fixes "foreach() argument must be of type array|string given" error.
- Improves stability when handling extrafields.
This commit is contained in:
Anthony V 2025-02-10 16:05:25 +01:00 committed by Laurent Destailleur (aka Eldy)
parent 982f6d6dc2
commit bc6e3a81da

View File

@ -1518,7 +1518,7 @@ if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUS
// Extrafields
$extrafields->fetch_name_optionals_label("product");
$extralabels = !empty($extrafields->attributes["product"]['label']) ? $extrafields->attributes["product"]['label'] : '';
$extralabels = !empty($extrafields->attributes["product"]['label']) ? $extrafields->attributes["product"]['label'] : [];
$extrafield_values = $extrafields->getOptionalsFromPost("product");
$sql = "SELECT";
$sql .= " fk_object";