Skip to content

Fix array to string conversion exception#30

Merged
avstudnitz merged 1 commit into
avstudnitz:masterfrom
therouv:fix-array-to-string-conversion
Nov 7, 2022
Merged

Fix array to string conversion exception#30
avstudnitz merged 1 commit into
avstudnitz:masterfrom
therouv:fix-array-to-string-conversion

Conversation

@therouv

@therouv therouv commented Oct 24, 2022

Copy link
Copy Markdown
Contributor

Changes in #28 introduced a change where the current value and scope value are cast to string. This leads however to the following exception, when using an array-serialized/serialized config field in store configuration:

Exception #0 (Exception): Warning: Array to string conversion in /var/www/html/vendor/avstudnitz/scopehint2/Plugin/ConfigFieldPlugin.php on line 138

Since the array values can be structured in multiple ways, I propose to just skip the array values and not generate a scope hint label for such cases. These kind of arrays often contain multiple entries anyways, so displaying changes in a popover is tricky anyways.

Noticed the bug while trying to configure the DHL extension which uses a custom ArraySerialized class. But Magento has those kind of classes in the core as well.

@avstudnitz

Copy link
Copy Markdown
Owner

Thank you @therouv! I noticed the same thing today, and fixed similarily, but your solution is slightly better.

@therouv therouv deleted the fix-array-to-string-conversion branch November 7, 2022 12:57
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