Skip to content

Commit 2bbcf26

Browse files
authored
Merge pull request #271 from jtojnar/wip/jtojnar/unitrim-mbstring-depr
unicodeTrim: Fix PHP 8.2 deprecation
2 parents 9a1d4c8 + 7e990a6 commit 2bbcf26

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

Mf2/Parser.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,7 @@ function collapseWhitespace($str) {
111111
}
112112

113113
function unicodeTrim($str) {
114-
// this is cheating. TODO: find a better way if this causes any problems
115-
$str = str_replace(mb_convert_encoding(' ', 'UTF-8', 'HTML-ENTITIES'), ' ', $str);
116-
$str = preg_replace('/^\s+/', '', $str);
117-
return preg_replace('/\s+$/', '', $str);
114+
return preg_replace('/^\s+|\s+$/u', '', $str);
118115
}
119116

120117
/**

0 commit comments

Comments
 (0)