diff --git a/src/error/PhutilOpaqueEnvelope.php b/src/error/PhutilOpaqueEnvelope.php index 1c9024ba..ef773fb1 100644 --- a/src/error/PhutilOpaqueEnvelope.php +++ b/src/error/PhutilOpaqueEnvelope.php @@ -60,11 +60,13 @@ final class PhutilOpaqueEnvelope extends Phobject { */ private function mask($string, $noise) { $result = ''; - for ($ii = 0; $ii < strlen($string); $ii++) { - $s = $string[$ii]; - $n = $noise[$ii % strlen($noise)]; + if (phutil_nonempty_string($string)) { + for ($ii = 0; $ii < strlen($string); $ii++) { + $s = $string[$ii]; + $n = $noise[$ii % strlen($noise)]; - $result .= chr(ord($s) ^ ord($n)); + $result .= chr(ord($s) ^ ord($n)); + } } return $result; }