Skip to content

5.x: deprecated mb_encode_mimeheader() usage #18444

Open
@dereuromark

Description

@dereuromark

Description

My logs are filling up with errors:

mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead
Trace:
Cake\Error\ErrorTrap->handleError() [internal], line ??
/var/www/app/vendor/symfony/polyfill-mbstring/Mbstring.php /var/www/app/vendor/symfony/polyfill-mbstring/Mbstring.php, line 152
Symfony\Polyfill\Mbstring\Mbstring::mb_encode_mimeheader() /var/www/app/vendor/symfony/polyfill-mbstring/bootstrap80.php, line 21
/var/www/app/vendor/cakephp/cakephp/src/Mailer/Message.php /var/www/app/vendor/cakephp/cakephp/src/Mailer/Message.php, line 1764
Cake\Mailer\Message->encodeForHeader() /var/www/app/vendor/cakephp/cakephp/src/Mailer/Message.php, line 815

Symfony polyfill seems to cause this with

    public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
    {
        trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING);
    }

Message::encodeForHeader() is using it apparently:

        $restore = mb_internal_encoding();
        mb_internal_encoding($this->appCharset);
        $return = mb_encode_mimeheader($text, $this->getHeaderCharset(), 'B');
        mb_internal_encoding($restore);

CakePHP Version

5.2

PHP Version

8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions