From 6ab671361b0052aec2db20f2fa0e8ce435886978 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 12 May 2014 11:22:51 +0200 Subject: [PATCH] Lower mbstring dependency --- .../FrameworkBundle/Console/Descriptor/Descriptor.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php index 3b3b28f570..c6c3ebb284 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php @@ -211,12 +211,8 @@ abstract class Descriptor implements DescriptorInterface if (is_bool($value) || is_array($value) || (null === $value)) { $jsonString = json_encode($value); - if (!function_exists('mb_strlen')) { - return substr($jsonString, 0, 60).(strlen($jsonString) > 60 ? ' ...' : ''); - } - - if (mb_strlen($jsonString) > 60) { - return mb_substr($jsonString, 0, 60).' ...'; + if (preg_match('/^(.{60})./us', $jsonString, $matches)) { + return $matches[1].'...'; } return $jsonString;