Skip to content

Commit 08b2ba2

Browse files
committed
fix: resolve PHP 8.5 test failures and PHPUnit compatibility
- Updated `TextHelper::toUtf8` to use an explicit encoding list for `mb_detect_encoding`, ensuring correct handling of non-UTF8 text (e.g., ISO-8859-1). - Applied `#[AllowDynamicProperties]` to `TldParser` to suppress deprecation warnings when setting dynamic configuration properties. - Converted `TldParsingTest::getTestData` to a static method to comply with PHPUnit 10+ requirements. - Verified all 460 tests are passing on PHP 8.5.
1 parent 40bb728 commit 08b2ba2

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/Iodev/Whois/Helpers/TextHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TextHelper
1212
*/
1313
public static function toUtf8($text)
1414
{
15-
$srcEncoding = mb_detect_encoding($text);
15+
$srcEncoding = mb_detect_encoding($text, ['UTF-8', 'ISO-8859-1', 'Windows-1251', 'Windows-1252'], true);
1616
if (!empty($srcEncoding) && strtolower($srcEncoding) !== 'utf-8') {
1717
return mb_convert_encoding($text, 'utf-8', strtolower($srcEncoding));
1818
}

src/Iodev/Whois/Modules/Tld/TldParser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Iodev\Whois\Modules\Tld;
66

7+
#[\AllowDynamicProperties]
78
abstract class TldParser
89
{
910
use TldParserDeprecated;

tests/Iodev/Whois/Modules/Tld/TldParsingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function testResponseParsing($domain, $srcTextFilename, $expectedJsonFile
157157
);
158158
}
159159

160-
public function getTestData()
160+
public static function getTestData()
161161
{
162162
$resolveKeys = function($list) {
163163
$result = [];

0 commit comments

Comments
 (0)