Contao: Bug in SelectMenu.php when creating the name for active attribute multiple

Created on 10 Sep 2020  路  3Comments  路  Source: contao/contao

Affected versions

Contao 4.4 and Contao 4.9

Description
Bug in SelectMenu.php when creating the name for active attribute multiple - see https://github.com/contao/core-bundle/blob/d6a89/src/Resources/contao/widgets/SelectMenu.php#L158

rtrim does not cut the "block" [], but treats the characters as an array - thus turning mcwtest[0][multi_select][] into mcwtest[0][multi_select... then the closing parenthesis is missing.

The problem occurs especially with MCW - this has been fixed, but it's a nasty hack.
https://github.com/menatwork/contao-multicolumnwizard-bundle/pull/87/files

bug

All 3 comments

Looks like a bug to me. But why do we strip that at all? 馃

But why do we strip that at all?

this happens only for the hidden field - maybe so that null comes as value and not an empty array?

see https://github.com/contao/core-bundle/commit/0392221ad9bfa5bc061dd710ca2c7ea2a2156962#diff-ecee54532cf6f0f1d798676d36f7961d

Correctly store multi select menus if no value is selected (see #7760).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mathContao picture mathContao  路  3Comments

aschempp picture aschempp  路  3Comments

rabauss picture rabauss  路  3Comments

leofeyer picture leofeyer  路  3Comments

theDyingMountain picture theDyingMountain  路  4Comments