jchristopher / attachments

[WordPress Plugin] Attachments allows you to simply append any number of items from your WordPress Media Library to Posts, Pages, and Custom Post Types
wordpress.org/extend/plugins/attachments/
GNU General Public License v2.0
241 stars 78 forks source link

Fix deleting media error #194

Open m-hefti opened 2 years ago

m-hefti commented 2 years ago

While deleting a media, you might get an error about classes/class.attachments.search.php:64 count() expecting an array and getting a null value. The $params['fields'] var might be an array or a null value (by default). If null, the count() function in the for loop (line 65) returns an error. Adding the if statement (line 64) resolves the problem.

didwedo commented 2 years ago

Thanks for the correction, it's greatly appreciated.

angryaxi commented 1 year ago

This should be merged. This fatal error happens on PHP version 8.0 and up.

As PHP 7.4 security updates stop in 6 days (28 Nov 2022), and many hosting providers have already moved sites to use PHP 8 it would be of utmost priority to publish a new version of this plugin to the WP plugin directory with this fix included.

This pull request fixes #193

stevensjn commented 1 week ago

Would love to help keep this plugin alive here, and on wordpress.org.