diff --git a/src/readableserializer/PhutilReadableSerializer.php b/src/readableserializer/PhutilReadableSerializer.php --- a/src/readableserializer/PhutilReadableSerializer.php +++ b/src/readableserializer/PhutilReadableSerializer.php @@ -33,6 +33,8 @@ return 'true'; } else if (is_float($value) && (int)$value == $value) { return $value.'.0'; + } else if (is_string($value)) { + return "'".$value."'"; } else { return print_r($value, true); } @@ -67,8 +69,13 @@ $limit = 1024; $str = self::printableValue($value); if (strlen($str) > $limit) { - $str = substr($str, 0, $limit).'...'; + if (is_string($value)) { + $str = "'".substr($str, 1, $limit)."...'"; + } else { + $str = substr($str, 0, $limit).'...'; + } } + return $str; } } diff --git a/src/readableserializer/__tests__/PhutilReadableSerializerTestCase.php b/src/readableserializer/__tests__/PhutilReadableSerializerTestCase.php --- a/src/readableserializer/__tests__/PhutilReadableSerializerTestCase.php +++ b/src/readableserializer/__tests__/PhutilReadableSerializerTestCase.php @@ -10,7 +10,7 @@ array(0, '0'), array(0.0, '0.0'), array(0.1, '0.1'), - array('test', 'test'), + array('test', "'test'"), ); foreach ($tests as $test) { list($value, $expect) = $test;