Skip to content

Commit aefeceb

Browse files
Replace iconv_*() uses by mb_*(), add mbstring polyfill when required
1 parent 481c7d8 commit aefeceb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Logger/DbalLogger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ private function normalizeParams(array $params)
9595
}
9696

9797
// detect if the too long string must be shorten
98-
if (self::MAX_STRING_LENGTH < iconv_strlen($params[$index], 'UTF-8')) {
99-
$params[$index] = iconv_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, 'UTF-8').' [...]';
98+
if (self::MAX_STRING_LENGTH < mb_strlen($params[$index], 'UTF-8')) {
99+
$params[$index] = mb_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, 'UTF-8').' [...]';
100100
continue;
101101
}
102102
}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
],
1818
"require": {
1919
"php": ">=5.3.9",
20-
"doctrine/common": "~2.4"
20+
"doctrine/common": "~2.4",
21+
"symfony/polyfill-mbstring": "~1.0"
2122
},
2223
"require-dev": {
2324
"symfony/stopwatch": "~2.2|~3.0.0",

0 commit comments

Comments
 (0)