Lower mbstring dependency
This commit is contained in:
parent
b3ec567224
commit
6ab671361b
@ -211,12 +211,8 @@ abstract class Descriptor implements DescriptorInterface
|
|||||||
if (is_bool($value) || is_array($value) || (null === $value)) {
|
if (is_bool($value) || is_array($value) || (null === $value)) {
|
||||||
$jsonString = json_encode($value);
|
$jsonString = json_encode($value);
|
||||||
|
|
||||||
if (!function_exists('mb_strlen')) {
|
if (preg_match('/^(.{60})./us', $jsonString, $matches)) {
|
||||||
return substr($jsonString, 0, 60).(strlen($jsonString) > 60 ? ' ...' : '');
|
return $matches[1].'...';
|
||||||
}
|
|
||||||
|
|
||||||
if (mb_strlen($jsonString) > 60) {
|
|
||||||
return mb_substr($jsonString, 0, 60).' ...';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $jsonString;
|
return $jsonString;
|
||||||
|
Reference in New Issue
Block a user