We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 86b2177 + 7b56403 commit b791f12Copy full SHA for b791f12
src/Document.php
@@ -74,9 +74,9 @@ private function getValidEncoding(?string $encoding): ?string
74
} else {
75
// PHP 8.0+: ValueError exception is thrown for invalid/empty encoding
76
try {
77
- $aliases = mb_encoding_aliases($encoding ?? '');
78
- // Check if aliases array is not empty (valid encoding should have at least one alias)
79
- return !empty($aliases) ? $encoding : null;
+ mb_encoding_aliases($encoding ?? '');
+ // If mb_encoding_aliases succeeds, return the input value as is. Some encodings do not have aliases.
+ return $encoding;
80
} catch (\ValueError $exception) {
81
return null;
82
}
0 commit comments