[Bug in code] Attribute with JSON. Module: magento2-hyva-checkout
hyva-themes/magento2-hyva-checkout:1.1.10 If the $value contains some JSON, you may encounter issues with the attribute tag. For example, if $value = {"test": 1} and $attribute = 'test', the code will produce:```test="{"test": 1}"```. It's incorrect. vendor/hyva-themes/magento2-hyva-checkout/src/Model/Form/EntityConcern/WithAttributes.php:110 ``` return implode(' ', array_map(function ($attribute, ?string $value) use ($escaper) { return $value === null ? $attribute : sprintf('%s="%s"', $attribute, $escaper ? $escaper->escapeHtmlAttr($value) : $value); }, array_keys($attributes), array_values($attributes))); ``` Patch for fix it. ``` Index: vendor/hyva-themes/magento2-hyva-checkout/src/Model/Form/EntityConcern/WithAttributes.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/vendor/hyva-themes/magento2-hyva-checkout/src/Model/Form/EntityConcern/WithAttributes.php b/vendor/hyva-themes/magento2-hyva-checkout/src/Model/Form/EntityConcern/WithAttributes.php --- a/vendor/hyva-themes/magento2-hyva-checkout/src/Model/Form/EntityConcern/WithAttributes.php +++ b/vendor/hyva-themes/magento2-hyva-checkout/src/Model/Form/EntityConcern/WithAttributes.php (date 1724166350832) @@ -108,7 +108,7 @@ } return implode(' ', array_map(function ($attribute, ?string $value) use ($escaper) { - return $value === null ? $attribute : sprintf('%s="%s"', $attribute, $escaper ? $escaper->escapeHtmlAttr($value) : $value); + return $value === null ? $attribute : sprintf("%s='%s'", $attribute, $escaper ? $escaper->escapeHtmlAttr($value) : $value); }, array_keys($attributes), array_values($attributes))); } } ```
issue