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

Fix PHP 8.1 "strlen(null)" and "array_slice(null)" exceptions which block typeahead completion proposals

Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

`array_slice()` no longer accepts passing `null` as a parameter.
This behavior is deprecated since PHP 8.1. Adding an if clause; not using a
Null Coalescing Operator (PHP 7+) as Phorge currently still supports PHP 5.5.

Closes T15321

Test Plan:
Applied these two changes on top of D25147. Afterwards, typeahead autocompletion
proposal dropdowns for the three fields "Assigned To", "Subscribers", "Tags" got
displayed in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15321

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

+6 -2
+1 -1
src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
··· 39 39 $parameters = array(); 40 40 41 41 $raw_parameters = $request->getStr('parameters'); 42 - if (strlen($raw_parameters)) { 42 + if (phutil_nonempty_string($raw_parameters)) { 43 43 try { 44 44 $parameters = phutil_json_decode($raw_parameters); 45 45 } catch (PhutilJSONParserException $ex) {
+5 -1
src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php
··· 207 207 } 208 208 209 209 protected function sliceResults(array $results) { 210 - $offset = $this->getOffset(); 210 + if ($this->getOffset()) { 211 + $offset = $this->getOffset(); 212 + } else { 213 + $offset = 0; 214 + } 211 215 $limit = $this->getLimit(); 212 216 213 217 if ($offset || $limit) {