1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-28 08:20:56 +01:00

Fix PHP 8.1 "strlen(null)" exception in PhutilOpaqueEnvelope.php

Summary:
This change fixes a RuntimeException for passing null to strlen() when setting up the DB host parameter

Closes T15260

Test Plan: I was able to run "./bin/config set mysql.host "localhost"" successfully

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: Ekubischta, goddenrich, Dylsss, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15260

Differential Revision: https://we.phorge.it/D25129
This commit is contained in:
Andre Klapper 2023-04-25 15:39:38 +02:00
parent ca5f5cd152
commit 82d1abd4ed

View file

@ -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;
}