1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-27 16:00:58 +01:00

Fix PHP 8.1 "strlen(null)" exception from ArcanistRefView which blocks "arc look remotes"

Summary:
This change fixes the command `arc look remotes` for PHP 8.1.

Without this change, the null value bubbles up to PhutilUTF8StringTruncator, reaching a strlen().

This control probably does not need to be done at this low level inside PhutilUTF8StringTruncator,
but it is right to be at this high level from the caller in ArcanistRefView.

Closes T15368

Test Plan:
- run "arc look remotes"
- still works in "old PHP" like 7.4
- start to work in recent PHP 8.1+

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15368

Differential Revision: https://we.phorge.it/D25206
This commit is contained in:
Valerio Bozzolan 2023-06-01 18:19:46 +02:00
parent 18554ea76c
commit 444bb60d43

View file

@ -72,6 +72,11 @@ final class ArcanistRefView
$object_name = $this->getObjectName();
$title = $this->getTitle();
// Our goal here is to work with strings, defaults or not
if ($title === null) {
$title = '';
}
if ($object_name !== null) {
$reserve_width = phutil_utf8_console_strlen($object_name) + 1;
} else {