Title: PHP Warnings &#8211; Debug.log
Last modified: June 11, 2020

---

# PHP Warnings – Debug.log

 *  Resolved [koolpal](https://wordpress.org/support/users/koolpal/)
 * (@koolpal)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/php-warnings-debug-log/)
 * Hi,
 * I am getting the below PHP Notice in debug.log
 * WP: 5.4.2
    Woocommerce: 4.2.0 Email Log: 2.3.2
 * `[11-Jun-2020 11:32:25 UTC] PHP Notice: Array to string conversion in F:\laragon\
   www\iGMS\wp-content\plugins\email-log\include\Util\helper.php on line 171`
 * I am also seeing the below warnings:
 *     ```
       [11-Jun-2020 11:38:16 UTC] PHP Warning:  strpos() expects parameter 1 to be string, array given in F:\laragon\www\iGMS\wp-includes\pluggable.php on line 240
       [11-Jun-2020 11:38:16 UTC] PHP Warning:  trim() expects parameter 1 to be string, array given in F:\laragon\www\iGMS\wp-includes\pluggable.php on line 248
       [11-Jun-2020 11:38:16 UTC] PHP Notice:  Undefined offset: 1 in F:\laragon\www\iGMS\wp-includes\pluggable.php on line 248
       ```
   
 * I am using the below code to change the **Reply to** address on outgoing emails.
 *     ```
       add_filter( 'woocommerce_email_headers', 'add_reply_to_certain_emails', 10, 2 );
       function add_reply_to_certain_emails ($headers, $object ) {
       	$add_reply_to = array(
       		'customer_on_hold_order',
       		'customer_processing_order',
       		'customer_completed_order',
       		'customer_refunded_order',
       		'customer_invoice',
       		'customer_note',
       		'customer_reset_password',
       		'customer_new_account',
       		);
       	if ( in_array( $object, $add_reply_to ) ) {
       		$headers = array( 
       			$headers,
       			'Reply-to: Domain.com <support@domain.com>' ."\r\n",
       			);
       	}
       	return $headers;
       ```
   
 * Please review and guide me on what changes to make. Please let me know in case
   you require any additional information.
 * Thanks a lot

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

 *  [Sudar Muthu](https://wordpress.org/support/users/sudar/)
 * (@sudar)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/php-warnings-debug-log/#post-12982296)
 * Hello [@koolpal](https://wordpress.org/support/users/koolpal/)
 * The warning is happening because of an issue in your code and not because of 
   WooCommerce or our Email Log plugin.
 * Basically the problem is that the `woocommerce_email_headers` filter filters 
   a string, but in your function you are converting it into an array. See [https://github.com/woocommerce/woocommerce/blob/master/includes/emails/class-wc-email.php#L421](https://github.com/woocommerce/woocommerce/blob/master/includes/emails/class-wc-email.php#L421)
   where this filter is getting used.
 * You should change your function to the following and this will fix the issue 
   for you.
 *     ```
       add_filter( 'woocommerce_email_headers', 'add_reply_to_certain_emails', 10, 2 );
       function add_reply_to_certain_emails ($headers, $object ) {
       	$add_reply_to = array(
       		'customer_on_hold_order',
       		'customer_processing_order',
       		'customer_completed_order',
       		'customer_refunded_order',
       		'customer_invoice',
       		'customer_note',
       		'customer_reset_password',
       		'customer_new_account',
       		);
   
       	if ( in_array( $object, $add_reply_to ) ) {
               $headers .= 'Reply-to: Domain.com <support@domain.com>' ."\r\n",
       	}
   
           return $headers;
       }
       ```
   
 * Try it out and let me know if you are still facing any issues.
 *  Thread Starter [koolpal](https://wordpress.org/support/users/koolpal/)
 * (@koolpal)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/php-warnings-debug-log/#post-12983516)
 * [@sudar](https://wordpress.org/support/users/sudar/)
 * Thank you for replying.
 * I tried your suggested code and I had to make the following changes to make this
   work
    1. Change , to ; at end of line 18 2. Remove remove the . after $headers
   and change the line to $headers = in line 18
 * `line 18: $headers = 'Reply-to: Domain.com <support@domain.com>' ."\r\n";`
 * There are no more notices now!
 * Thanks a lot!
 *  [Sudar Muthu](https://wordpress.org/support/users/sudar/)
 * (@sudar)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/php-warnings-debug-log/#post-12985102)
 * [@koolpal](https://wordpress.org/support/users/koolpal/)
 * Glad to know that you got it working.

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

The topic ‘PHP Warnings – Debug.log’ is closed to new replies.

 * ![](https://ps.w.org/email-log/assets/icon-256x256.png?rev=1710920)
 * [Email Log](https://wordpress.org/plugins/email-log/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/email-log/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/email-log/)
 * [Active Topics](https://wordpress.org/support/plugin/email-log/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/email-log/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/email-log/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Sudar Muthu](https://wordpress.org/support/users/sudar/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/php-warnings-debug-log/#post-12985102)
 * Status: resolved