OXIDprojects / oxid_modules_config

OXID Module Configuration Im-/Exporter module by OXID Professional Services
GNU General Public License v3.0
3 stars 9 forks source link

Fix wrong config type detection #49

Closed alfredbez closed 4 years ago

alfredbez commented 4 years ago

If you pass an assoc-array with exactly 1 value it is screwed up by that check. We ended up with strange data like this in one of our projects:

MySQL [oxid]> SELECT * FROM `oxconfig` WHERE `OXVARNAME` = 'moduleSmartyPluginDirectories' \G
*************************** 1. row ***************************
                      OXID: 077f925565f97224aa60355d6d07553b
                  OXSHOPID: 1
                  OXMODULE:
                 OXVARNAME: moduleSmartyPluginDirectories
                 OXVARTYPE: ffwebcomponents
                OXVARVALUE:

               OXTIMESTAMP: 2020-10-15 14:57:15

Note that the OXVARTYPE is set to the module-id in our case, but it should be aarr. The value in our yaml file looks like this:

moduleSmartyPluginDirectories:
    ffwebcomponents:
        - views/smarty

I tested it also with more than one module and I was able to confirm, that this will work (since the count-check is only buggy for exactly one array-item):

moduleSmartyPluginDirectories:
    ffwebcomponents:
        - views/smarty
    foo:
        - bar

cc @bertrandjackermann @SvenBrunk @keywan-ghadami-oxid

alfredbez commented 4 years ago

I added a check for special types like str and tested this manually in our project, looks good now.

alfredbez commented 4 years ago

Thanks for the merge @keywan-ghadami-oxid, can you also have a look at https://github.com/OXIDprojects/oxid_shop_config/pull/1?