@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 "Undefined offset: 1" exception in Diviner when @task value in PHPDoc is a single word

Summary:
The PHPDoc in https://we.phorge.it/source/phorge/browse/master/src/infrastructure/storage/lisk/LiskMigrationIterator.php$14 defines `* @task storage`.
That means the value of `$task` in the DivinerAtomController class is the single string `storage` and there is no whitespace to `explode` on and there is no second key in the array to set as `$title`.
Thus only call `explode` when `$task` contains a whitespace.

```
EXCEPTION: (RuntimeException) Undefined array key 1 at [<arcanist>/src/error/PhutilErrorHandler.php:273]
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diviner/controller/DivinerAtomController.php:450]
```

Closes T15854

Test Plan: Go to https://we.phorge.it/book/contrib/article/database/#primary-keys and click the `LiskMigrationIterator` link pointing to https://we.phorge.it/book/dev/class/LiskMigrationIterator/

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15854

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

+5 -1
+5 -1
src/applications/diviner/controller/DivinerAtomController.php
··· 446 446 447 447 if ($tasks) { 448 448 foreach ($tasks as $task) { 449 - list($name, $title) = explode(' ', $task, 2); 449 + if (strpos($task, ' ') !== false) { 450 + list($name, $title) = explode(' ', $task, 2); 451 + } else { 452 + list($name, $title) = array($task, ''); 453 + } 450 454 $name = trim($name); 451 455 $title = trim($title); 452 456