Problem with array of arrays
-
Hi there,
thanks for the great plugin.I would like to report an issue however.
Problems arise from the use of
json_encode()
andjson_decode()
. Specifically, a widget that I’ve built makes use of an array of arrays to store repeating fields. This doesn’t really play nice with json_decode() as it recreates the data as an array of stdClass objects instead, generating fatal errors when trying to access the data as an array. As a result, the widgets screen breaks and there is no way to remove the offending widget.
Use ofserialize()
andunserialize()
would be more appropriate as they restore the data to their original data types, however I understand that it’s not a simple matter of changing that now (for back-compat reasons), and you might also have your reasons for doing it the way you did.A possible solution would be, taking everything I can think of into account, adding a second export and import option, perhaps with a different extension, that utilizes
serialize()
andunserialize()
instead?For now, the only workaround I can see, is hooking into the
wie_unencoded_export_data
andwie_before_import
filters, encoding the data in a format that can be properly decoded, without being affected by the json functions. This however, will make the .wie files produced incompatible with other installations.I’d really love to hear your take on this.
Regards,
Anastis Sourgoutsidishttps://www.ads-software.com/plugins/widget-importer-exporter/
- The topic ‘Problem with array of arrays’ is closed to new replies.