[WordPress Plugin] Attachments allows you to simply append any number of items from your WordPress Media Library to Posts, Pages, and Custom Post Types
The wp_get_attachment_metadata( $attachment->id ) returns an empty string ('') when there is no attachment_metadata. On PHP 7.1.1, empty strings are not implicitly converted to arrays when one attempts to assign a value to a string key on that variable, and instead return a warning.
This fix does explicit conversion of wp_get_attachment_metadata( $attachment->id ) to an array to avoid the illegal offset 'file' when running on PHP 7.1.1.
The
wp_get_attachment_metadata( $attachment->id )
returns an empty string (''
) when there is no attachment_metadata. On PHP 7.1.1, empty strings are not implicitly converted to arrays when one attempts to assign a value to a string key on that variable, and instead return a warning.This fix does explicit conversion of
wp_get_attachment_metadata( $attachment->id )
to an array to avoid theillegal offset 'file'
when running on PHP 7.1.1.fixes #173