[WordPress Plugin] Attachments allows you to simply append any number of items from your WordPress Media Library to Posts, Pages, and Custom Post Types
Illegal string offset 'file' in /var/www/cleanroom/web/app/plugins/attachments/classes/class.attachments.php on line 1329
Warning: Illegal string offset 'file' in /var/www/cleanroom/web/app/plugins/attachments/classes/class.attachments.php on line 1330
Warning: Illegal string offset 'file' in /var/www/cleanroom/web/app/plugins/attachments/classes/class.attachments.php on line 1335
In PHP 7.1.1, empty strings are not auto-converted to arrays when attempting to assign a value to a string-based key:
will convert $attachment_meta to an array and properly assign the key in earlier versions of PHP, but will result in a warning and unexpected behavior in PHP 7.1.1.
If there is no attachment metadata, wp_get_attachment_metadata( $attachment->id ) will return and empty string, which results in the above errors.
One solution would be to make sure you are getting an array back from wp_get_attachment_metadata() by doing explicit type-conversion to array on line 1325.
Getting the following errors on PHP 7.1.1:
In PHP 7.1.1, empty strings are not auto-converted to arrays when attempting to assign a value to a string-based key:
will convert
$attachment_meta
to an array and properly assign the key in earlier versions of PHP, but will result in a warning and unexpected behavior in PHP 7.1.1.If there is no attachment metadata,
wp_get_attachment_metadata( $attachment->id )
will return and empty string, which results in the above errors.One solution would be to make sure you are getting an array back from
wp_get_attachment_metadata()
by doing explicit type-conversion to array on line 1325.