1

I upgraded to Magento 1.9.3.0 and now the following bug occurs:

If I save a select or multiselect attribute in admin panel, the option labels for the stores get mixed up or deleted. Example: After saving the attribute the option label for english store is now on the german store but the label from another store gets completely deleted. After each saving one more store loses his option label until all labels are deleted and the labels are mixed up (randomly!?) again. (note: i am talking about the select or multiselect option labels, not the attribute labels) note2: the mixing of the labels occurs only between stores and not between the options

Can anyone confirm this behavior or can anyone test this on a dev machine?

I am wondering if it is a Magento bug or some interference with my extensions.

1

To answer my own question:

This is a bug in Magento 1.9.3.

They changed in app\code\core\Mage\Adminhtml\controllers\Catalog\Product\AttributeController.php

from (line 182)

$data['option']['value'][$key] = array_map(array($helperCatalog, 'stripTags'), $values);

to:

...
$data['option']['value'][$key] = array_map(
                    array($helperCatalog, 'stripTags'),
                    $values,
                    array_fill(
                        0,
                        count($values),
                        $isHtmlAllowedOnFrontend ? sprintf('<%s>', implode('><', $this->_getAllowedTags())): null
                    )
                );
...

The second array that is passed to array_map destroys the keys of the array, stated in php documentation:

"The returned array will preserve the keys of the array argument if and only if exactly one array is passed. If more than one array is passed, the returned array will have sequential integer keys. "

So the keys that represent store_ids get mixed up.

This is quite dangerous!

I will report this as a bug to Magento

  • You can also accept your own answer :) – sv3n Jul 24 '17 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.