Skip to content

Commit

Permalink
Merge pull request #599 from phil-davis/remove-utf8_encode-for-4.5
Browse files Browse the repository at this point in the history
Remove utf8_encode
  • Loading branch information
phil-davis authored Oct 9, 2022
2 parents d1fdc0c + 167a599 commit 1f83674
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
coverage: ['pcov']
code-analysis: ['no']
include:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
ChangeLog
=========

4.5.1 (2022-10-09)
------------------

* #597: Remove utf8_encode to easily support PHP 8.2 (@phil-davis)

4.5.0 (2022-08-17)
------------------

Expand Down
4 changes: 1 addition & 3 deletions lib/Parser/MimeDir.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,8 @@ protected function readProperty($line)
switch (strtolower($charset)) {
case 'utf-8':
break;
case 'iso-8859-1':
$property['value'] = utf8_encode($property['value']);
break;
case 'windows-1252':
case 'iso-8859-1':
$property['value'] = mb_convert_encoding($property['value'], 'UTF-8', $charset);
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion lib/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class Version
/**
* Full version number.
*/
const VERSION = '4.5.0';
const VERSION = '4.5.1';
}
5 changes: 3 additions & 2 deletions tests/VObject/StringUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ public function testUTF8ControlChar()

public function testConvertToUTF8nonUTF8()
{
$string = StringUtil::convertToUTF8(chr(0xbf));
// 0xBF is an ASCII upside-down question mark
$string = StringUtil::convertToUTF8(chr(0xBF));

$this->assertEquals(utf8_encode(chr(0xbf)), $string);
$this->assertEquals(mb_convert_encoding(chr(0xBF), 'UTF-8', 'ISO-8859-1'), $string);
}

public function testConvertToUTF8IsUTF8()
Expand Down

0 comments on commit 1f83674

Please sign in to comment.