Page MenuHomePhabricator

D19564.diff
No OneTemporary

D19564.diff

diff --git a/src/serviceprofiler/PhutilServiceProfiler.php b/src/serviceprofiler/PhutilServiceProfiler.php
--- a/src/serviceprofiler/PhutilServiceProfiler.php
+++ b/src/serviceprofiler/PhutilServiceProfiler.php
@@ -190,7 +190,24 @@
$mark,
$id,
$type,
- $desc);
+ self::escapeProfilerStringForDisplay($desc));
}
+ private static function escapeProfilerStringForDisplay($string) {
+ // Convert tabs and newlines to spaces and collapse blocks of whitespace,
+ // most often formatting in queries.
+ $string = preg_replace('/\s{2,}/', ' ', $string);
+
+ // Replace sequences of binary characters with printable text. We allow
+ // some printable characters to appear in between unprintable characters
+ // to try to collapse the entire run.
+ $string = preg_replace(
+ '/[\x00-\x1F\x7F-\xFF](.{0,12}[\x00-\x1F\x7F-\xFF])*/',
+ '<...binary data...>',
+ $string);
+
+ return $string;
+ }
+
+
}

File Metadata

Mime Type
text/plain
Expires
Mar 10 2025, 5:05 AM (5 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7401629
Default Alt Text
D19564.diff (967 B)

Event Timeline