@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

PHP 8.5: Fix null array key in HeraldRuleController repetition handling

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."

```
ERROR 8192: Using null as an array offset is deprecated, use an empty string instead at [/var/www/html/phorge/phorge/src/applications/herald/controller/HeraldRuleController.php:273]
```

Closes T16530

Test Plan: On PHP 8.5, go to http://phorge.localhost/herald/edit/?content_type=HeraldPreCommitRefAdapter&rule_type=object&targetPHID=PHID-PROJ-somevalidprojectphid

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16530

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

+2 -1
+2 -1
src/applications/herald/controller/HeraldRuleController.php
··· 270 270 // value so we didn't render a control, adjust the value to the first 271 271 // valid policy value. 272 272 $repetition_options = $this->getRepetitionOptionMap($adapter); 273 - if (!isset($repetition_options[$repetition_policy])) { 273 + if (!$repetition_policy || 274 + !isset($repetition_options[$repetition_policy])) { 274 275 $repetition_policy = head_key($repetition_options); 275 276 } 276 277