Closed fballiano closed 3 months ago
Why not use empty()
to check:
// from
$data['label'] = ($image['label'] === null || $image["label_use_default"]) ? null : $image['label'];
// to
$data['label'] = ($image['label'] === null || empty($image["label_use_default"])) ? null : $image['label'];
@kiatng if i'm not mistaken that wouldn't cover the "store id = 0" situation and, when the conditions are in || but not all positive they automatically become hard to read to me :-)
@fballiano You are right. I got confused with if ($storeId === 0) $image["label_use_default"] = false;
. We want store 0 to have the default label, but in order to make sure of that, $image["label_use_default"]
needs to be set to false, regardless of its prior value. It's counter intuitive.
when the conditions are in || but not all positive
It's hard as hell for me too.
Fixes https://github.com/OpenMage/magento-lts/issues/4023
There could be other ways to fix this problem but I would initialize those 2 array elements