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 GitHub
parent 5e47f63c8b
commit 2358dc81a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1539,7 +1539,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";