From bc6e3a81dab0d67686f2ad791df79fc1740ef2f3 Mon Sep 17 00:00:00 2001 From: Anthony V <45999044+AnthonyVallenet@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:05:25 +0100 Subject: [PATCH] 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. --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 1b55ff6dda4..006c8710770 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -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";