Skip to content

Attribute values containing multidimensional data will cause an mb_srtlen exception #132

Description

@TheKeymaster

Describe the bug

Passing a multidimensional array to the Attribute instance, will cause an mb_strlen exception.

To Reproduce

// Simply create a new Attribute instance and pass it multidimensional array data:
new \FINDOLOGIC\Export\Data\Attribute(
    'attribute_with_very_long_value',
    [
        'ayy' => [
            'interesting' => 'nice'
        ]
    ]
);

Expected behavior

A clear exception indicating I have passed wrong data there, which isn't valid.

Actual behavior

An mb_strlen exception happens, which isn't really clear about what happened:

mb_strlen() expects parameter 1 to be string, array given
 /home/dom/github/findologic/libflexport/src/FINDOLOGIC/Export/Helpers/DataHelper.php:101
 /home/dom/github/findologic/libflexport/src/FINDOLOGIC/Export/Data/Attribute.php:37
 /home/dom/github/findologic/libflexport/src/FINDOLOGIC/Export/Data/Attribute.php:46
 /home/dom/github/findologic/libflexport/src/FINDOLOGIC/Export/Data/Attribute.php:28

Screenshots

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions