@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PHP 8.5: Avoid null array keys in PhabricatorEditEngineConfigurationQuery::loadPage()

Summary:
Setting null as an array key is deprecated since PHP 8.5 per https://www.php.net/releases/8.5/en.php: "Using null as an array offset or when calling array_key_exists() is now deprecated. Use an empty string instead."

`PhabricatorEditEngineConfiguration::getID()` can return null when it is a builtin configuration, see e.g. existing null handling in `PhabricatorEditEngineConfiguration::getIdentifier()`.
I didn't investigate the `getPHID()` spiel though.

```
ERROR 8192: Using null as an array offset is deprecated, use an empty string instead at [/var/www/html/phorge/phorge/src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php:134]
ERROR 8192: Using null as an array offset is deprecated, use an empty string instead at [/var/www/html/phorge/phorge/src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php:143]
```

Closes T16438

Test Plan:
* On PHP 8.5, go to http://phorge.localhost/transactions/editengine/maniphest.task/view/1/ and select "Edit Form Configuration"
* On PHP 8.5, go to http://phorge.localhost/transactions/editengine/transactions.editengine.config/view/2/ and do something to reload that page (for example: select "Change Field Order", then reorder some fields, and click "Save Changes")

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: mainframe98, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16438

Differential Revision: https://we.phorge.it/D26657

+2 -2
+2 -2
src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php
··· 131 131 if ($this->ids !== null) { 132 132 $ids = array_fuse($this->ids); 133 133 foreach ($page as $key => $config) { 134 - if (empty($ids[$config->getID()])) { 134 + if (!$config->getID() || empty($ids[$config->getID()])) { 135 135 unset($page[$key]); 136 136 } 137 137 } ··· 140 140 if ($this->phids !== null) { 141 141 $phids = array_fuse($this->phids); 142 142 foreach ($page as $key => $config) { 143 - if (empty($phids[$config->getPHID()])) { 143 + if (!$config->getPHID() || empty($phids[$config->getPHID()])) { 144 144 unset($page[$key]); 145 145 } 146 146 }