Title: PHP Warning about paramater
Last modified: September 1, 2016

---

# PHP Warning about paramater

 *  [Hans Schuijff](https://wordpress.org/support/users/hanswitteprins/)
 * (@hanswitteprins)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/)
 * Hi, I’ve noticed my log building a php warning. Is it bug? Would be nice if the
   warning is resolved.
 * “PHP Warning: in_array() expects parameter 2 to be array, string given in /home/
   dewitteprins/public_html/wp-content/plugins/mention-comments-authors/mention-
   comments-authors.php on line 249”
 * Cheers, Hans
 * [https://wordpress.org/plugins/mention-comments-authors/](https://wordpress.org/plugins/mention-comments-authors/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [lucaskuperman](https://wordpress.org/support/users/lucaskuperman/)
 * (@lucaskuperman)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/#post-8350609)
 * Hans, I’m receiving the same thing. Did someone answer you? Were you able to 
   resolve it yourself? Are your emails being sent despite of this warning? Thanks
 *  Thread Starter [Hans Schuijff](https://wordpress.org/support/users/hanswitteprins/)
 * (@hanswitteprins)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/#post-8352367)
 * Hi Lucas,
 * No I didn’t get answer on this point and the error is still reported in my own
   log.
 * Hans
 *  Thread Starter [Hans Schuijff](https://wordpress.org/support/users/hanswitteprins/)
 * (@hanswitteprins)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/#post-8352442)
 * Hi Lucas.
 * I’ve Looked into the code now and think it isn’t that hard to solve myself. It
   seems that the plugin developer has just got the arguments of the in_array() 
   function switched.
 * The warning is generated by the use of in_array in following code:
 *     ```
       function mca_email_poked_ones( $comment_id, $approved ) {
           if( add_filter( 'mca_send_email_on_mention', true ) && in_array( array( 1, 'approve' ), $approved ) ) {
       ```
   
 * As you can see the second parameter ($approved) is passed through by the caller
   of mca_email_poked_ones.
 * The only call of the function mca_email_poked_ones I could find is in line 277,
   which says:
 *     ```
               mca_email_poked_ones( $comment_id, 1 );
       ```
   
 * The second parameter being the integer 1.
 * The syntax of in_array being
 *     ```
       in_array(term_to_search_for,array,type) 
       ```
   
 * Changing line 249 to
 *     ```
           if( add_filter( 'mca_send_email_on_mention', true ) && in_array( $approved, array( 1, 'approve' ) ) ) {
       ```
   
 * should do the trick. Line 249 probably just wants to check if $approved is either
   1 or ‘approve’.
 * Hope it helps.
 * Hans
    -  This reply was modified 9 years, 7 months ago by [Hans Schuijff](https://wordpress.org/support/users/hanswitteprins/).
      Reason: typo
 *  [lucaskuperman](https://wordpress.org/support/users/lucaskuperman/)
 * (@lucaskuperman)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/#post-8354870)
 * Thanks Hans. I applied your fix and I don’t see the warning any more. However,
   I never receive the email. Did you ever receive the notifications from this plugin?
 *  Thread Starter [Hans Schuijff](https://wordpress.org/support/users/hanswitteprins/)
 * (@hanswitteprins)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/#post-8354911)
 * To be honest, I hadn’t even noticed that functionality in the plugin. Perhaps
   I test it at some later point. The faq gives some instructions about how to disable
   that functionality and change the emails, but it should work. I’ll let you know
   when I find something. Given the lack of respons from the developer, I quess 
   this isn’t a plugin that is actively maintained at the moment.
 *  [lucaskuperman](https://wordpress.org/support/users/lucaskuperman/)
 * (@lucaskuperman)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/#post-8354941)
 * I agree. Thank you Hans!
 *  Thread Starter [Hans Schuijff](https://wordpress.org/support/users/hanswitteprins/)
 * (@hanswitteprins)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/#post-8354987)
 * I have tried one comment with myself as mentioned author, but get a http error
   405 now. With the warning it didn’t. I think since the in_array warning was about
   the first selection in the function that send the emails, the if in the beginning
   never was true so the functionality was never actually performed. Now it is, 
   it results in a http 405. I guess it should be debugged some more. Perhaps better
   do that before using it.
 *  Thread Starter [Hans Schuijff](https://wordpress.org/support/users/hanswitteprins/)
 * (@hanswitteprins)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/#post-8355005)
 * I did receive the emails now by the way. So the error doesn’t prevent that. The
   comment was also added. But it still needs some tlc.
 *  [lucaskuperman](https://wordpress.org/support/users/lucaskuperman/)
 * (@lucaskuperman)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/#post-8355032)
 * Thank you so much Hans!!

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘PHP Warning about paramater’ is closed to new replies.

 * ![](https://ps.w.org/mention-comments-authors/assets/icon-256x256.png?rev=1066074)
 * [Mention comment's Authors by Wabeo](https://wordpress.org/plugins/mention-comments-authors/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mention-comments-authors/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mention-comments-authors/)
 * [Active Topics](https://wordpress.org/support/plugin/mention-comments-authors/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mention-comments-authors/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mention-comments-authors/reviews/)

## Tags

 * [PHP Warning](https://wordpress.org/support/topic-tag/php-warning/)

 * 9 replies
 * 2 participants
 * Last reply from: [lucaskuperman](https://wordpress.org/support/users/lucaskuperman/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/php-warning-about-paramater/#post-8355032)
 * Status: not resolved