Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong config type detection #49

Conversation

alfredbez
Copy link

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

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
```
@alfredbez alfredbez force-pushed the fix-wrong-config-type-detection branch from 6abc048 to e8fccd9 Compare October 16, 2020 08:59
@alfredbez
Copy link
Author

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

@keywan-ghadami-oxid keywan-ghadami-oxid merged commit 9050cf0 into OXIDprojects:master Oct 16, 2020
@alfredbez
Copy link
Author

Thanks for the merge @keywan-ghadami-oxid, can you also have a look at OXIDprojects/oxid_shop_config#1?

@alfredbez alfredbez deleted the fix-wrong-config-type-detection branch October 16, 2020 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants