Title: Bugs in code throwing PHP warnings
Last modified: September 1, 2016

---

# Bugs in code throwing PHP warnings

 *  [tripflex](https://wordpress.org/support/users/tripflex/)
 * (@tripflex)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/bugs-in-code-throwing-php-warnings/)
 * Due to the way some of your code is written, there are instances where a PHP 
   Warning is being thrown…
 * In your `getAttachmentStruct` method you’re returning either _**WP\_Error or 
   array**_, but when you make that call, you’re calling it directly inside of an`
   array_merge` call … you should be checking if it’s a WP_Error object before trying
   to merge it into an array
 *     ```
       // attachments
                   $attachment_content =array();
                   foreach($attachments as $attachment){
                       $attachment_content = array_merge($attachment_content, self::getAttachmentStruct($attachment));
                   }
       ```
   
 * [https://wordpress.org/plugins/mailin/](https://wordpress.org/plugins/mailin/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Brevo](https://wordpress.org/support/users/neeraj_slit/)
 * (@neeraj_slit)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/bugs-in-code-throwing-php-warnings/#post-7684899)
 * Hi tripflex
 * Thanks for your suggestion. It is fixed in new version.

Viewing 1 replies (of 1 total)

The topic ‘Bugs in code throwing PHP warnings’ is closed to new replies.

 * ![](https://ps.w.org/mailin/assets/icon-256x256.png?rev=2993173)
 * [Brevo - Email, SMS, Web Push, Chat, and more.](https://wordpress.org/plugins/mailin/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailin/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailin/)
 * [Active Topics](https://wordpress.org/support/plugin/mailin/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailin/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailin/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Brevo](https://wordpress.org/support/users/neeraj_slit/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/bugs-in-code-throwing-php-warnings/#post-7684899)
 * Status: not resolved