Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text Email sending fails with Array to String conversion notice #118

Closed
colorninja opened this issue Nov 13, 2020 · 3 comments
Closed

Text Email sending fails with Array to String conversion notice #118

colorninja opened this issue Nov 13, 2020 · 3 comments

Comments

@colorninja
Copy link

colorninja commented Nov 13, 2020

First of all, thank you so much for supporting PHP7 for this legacy beast!

Today I came across a problem, where I get the following notice:

message: "Array to string conversion"
code: 8
file: "/var/www/html/vendor/shardj/zf1-future/library/Zend/Mime.php"
line: 472
severity: E_NOTICE

when I try to send an email without HTML content - just Text and one attachment.

I had a look around the code and on that line it looks like the str_replace function is used incorrectly.

    /**
     * Converts a string into quoted printable format.
     *
     * @param  string $str
     * @return string
     */
    private static function _encodeQuotedPrintable($str)
    {
        $str = str_replace(
            ['=', self::$qpKeys],
            ['=3D', self::$qpReplaceValues],
            $str);
        
        return rtrim($str);
    }

qpKeys and qpRelaceValues (both arrays) should be spread in order for it to work as expected in future PHP versions.

We could use the spread operator, but since you are aiming min 7.0 support, another means should be used. I will create a PR soon.

@Shardj
Copy link
Owner

Shardj commented Nov 17, 2020

Yeah looks like it's just an array merge needed between ['='] and self::$qpKeys and the same for ['=3D'] and self::$qpReplaceValues for params 1 and 2 respectively. I'll wait for your PR

@arueckauer
Copy link

Running into the same issue. PR LGTM. Anything I can help get this released?

@Shardj Shardj closed this as completed in 9230c85 Nov 24, 2020
Shardj added a commit that referenced this issue Nov 24, 2020
…-sending

fix: Merge arrays for quoted printable table lookups (Close #118)
@Shardj
Copy link
Owner

Shardj commented Nov 24, 2020

@arueckauer release-1.18.8 has this out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants