• Resolved jackigmail

    (@jackigmail)


    Am using the latest version of Easy WP SMTP, Version 1.4.7
    Recently moved from PHP 7.4 to PHP 8.0. Am now seeing this warning in debug.log file:

    Warning: Array to String Conversion… easy-wp-smtp/easy-wp-smtp.php: line 75

    Has anyone else seeing this error?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thank you for reaching out to us. I have submitted a message to the developers to investigate further your issue.

    Kind regards.

    Looks like the email “Subject” field’s value may have some incorrect formatting. So it’s creating this notice in PHP 8 (PHP 7 was ignoring it).

    What is the subject line of the email in question? The email that produces that notice.

    Thread Starter jackigmail

    (@jackigmail)

    It was the To: field that had the array.
    I changed this line:
    $line = sprintf(
    ‘Headers: %s, To: %s, Subject: %s’,
    ! empty( $args[‘headers’] && is_array( $args[‘headers’] ) ) ? implode( ‘ | ‘, $args[‘headers’] ) : ”,
    ! empty( $args[‘to’] ) : ”,
    ! empty( $args[‘subject’] ) ? $args[‘subject’] : ”
    );

    To this:
    $line = sprintf(
    ‘Headers: %s, To: %s, Subject: %s’,
    ! empty( $args[‘headers’] && is_array( $args[‘headers’] ) ) ? implode( ‘ | ‘, $args[‘headers’] ) : ”,
    ! empty( $args[‘to’] && is_array( $args[‘to’] ) ) ? implode( ‘ ; ‘, $args[‘to’] ) : ”,
    ! empty( $args[‘subject’] ) ? $args[‘subject’] : ”
    );

    And the Warning no longer occurs.
    Thank you.

    That looks good but it doesn’t cover one scenario where the “to” field is not an array.

    I have made a change to the plugin that should handle this. Please download the following copy of the plugin and test it out.

    https://wp-ecommerce.net/wp-content/uploads/plugin-downloads/easy-wp-smtp.zip

    Let me know how that goes.

    Thread Starter jackigmail

    (@jackigmail)

    Works just perfect. Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Array To String conversion Warning (PHP 8.0)’ is closed to new replies.