$field has always been $field = 'cssClasses' and not the class key
The return value of array_search has always been false since cssClasses was never within the classlist, thus returning false
Checking for !false would return true which would trigger the condition
The $key would be false, $arrClasses[false] is the same as $arrClasses[0] and would replace the index with number 0
The fix
This is fixed with the following code since it'll actually get they $key based on the $cssClass['key'] now.
I also changed it to check for false !== $key rather than !$key for type safety
// Overwrite existing value
if (false !== ($key = array_search($cssClass['key'], array_column($arrClasses, 'key'))))
{
...
Description
This PR fixes an issue where trying to override the bundle-configuration via style-manager archives would result in only replacing the first value.
Also fixes #99
Explanation of the bug
$field
has always been$field = 'cssClasses'
and not the class keycssClasses
was never within the classlist, thus returningfalse
!false
would returntrue
which would trigger the condition$key
would be false,$arrClasses[false]
is the same as$arrClasses[0]
and would replace the index with number 0The fix
This is fixed with the following code since it'll actually get they
$key
based on the $cssClass['key'] now. I also changed it to check for false !== $key rather than !$key for type safety