Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14110818
D9632.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9632.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D9632: Fix `PhutilReadableSerializer` to quote strings.
Attached
Detach File
Event Timeline
Log In to Comment