Page MenuHomePhabricator

D9632.diff
No OneTemporary

D9632.diff

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;

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 7:12 PM (21 h, 42 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6798755
Default Alt Text
D9632.diff (1 KB)

Event Timeline