Skip to content

Commit 3368ceb

Browse files
committed
1 parent 09a76b8 commit 3368ceb

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

system/libraries/Email.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,11 +1563,10 @@ protected function _prep_q_encoding($str)
15631563

15641564
if ($this->charset === 'UTF-8')
15651565
{
1566-
if (MB_ENABLED === TRUE)
1567-
{
1568-
return mb_encode_mimeheader($str, $this->charset, 'Q', $this->crlf);
1569-
}
1570-
elseif (ICONV_ENABLED === TRUE)
1566+
// Note: We used to have mb_encode_mimeheader() as the first choice
1567+
// here, but it turned out to be buggy and unreliable. DO NOT
1568+
// re-add it! -- Narf
1569+
if (ICONV_ENABLED === TRUE)
15711570
{
15721571
$output = @iconv_mime_encode('', $str,
15731572
array(
@@ -1590,6 +1589,10 @@ protected function _prep_q_encoding($str)
15901589

15911590
$chars = iconv_strlen($str, 'UTF-8');
15921591
}
1592+
elseif (MB_ENABLED === TRUE)
1593+
{
1594+
$chars = mb_strlen($str, 'UTF-8');
1595+
}
15931596
}
15941597

15951598
// We might already have this set for UTF-8

user_guide_src/source/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Bug fixes for 3.0.3
2222
- Fixed a bug where :doc:`Database Transaction <database/transactions>` methods ``trans_begin()``, ``trans_commit()``, ``trans_rollback()`` ignored failures.
2323
- Fixed a bug where all :doc:`Database Transaction <database/transactions>` methods returned TRUE while transactions are actually disabled.
2424
- Fixed a bug where :doc:`common function <general/common_functions>` :php:func:`html_escape()` modified keys of its array inputs.
25+
- Fixed a bug (#4192) - :doc:`Email Library <libraries/email>` wouldn't always have proper Quoted-printable encoding due to a bug in PHP's own ``mb_mime_encodeheader()`` function.
2526

2627
Version 3.0.2
2728
=============

0 commit comments

Comments
 (0)