From e4fd31ec024edebec87fae0da990facf20d09ade Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Sun, 21 May 2023 00:06:42 +0200 Subject: [PATCH] Fix PHP 8.1 exception in Conduit: Make "array_fuse(array $list)" accept null as parameter Summary: `array_fuse` in Arcanist is a wrapper for calling `array_combine($list, $list)`. The latter doesn't accept passing `null` in PHP 8.2. Going to `/conduit/method/project.create/`, entering a `name` but nothing as `members` (so we pass `null`), and calling this method, an exception is thrown. Thus make `array_fuse` accept null and return an empty list in such cases. Closes T15393 Test Plan: Applied this change; afterwards "Method Call Result" page at `/api/project.create` correctly displayed in the web browser. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15393 Differential Revision: https://we.phorge.it/D25228 --- src/utils/utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/utils.php b/src/utils/utils.php index 37466bc6..53e9f809 100644 --- a/src/utils/utils.php +++ b/src/utils/utils.php @@ -954,7 +954,7 @@ function phutil_split_lines($corpus, $retain_endings = true) { * @param list List of scalars. * @return dict Dictionary with inputs mapped to themselves. */ -function array_fuse(array $list) { +function array_fuse(array $list = null) { if ($list) { return array_combine($list, $list); }