1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

Fix an issue where PhabricatorHandleList could fail to completely iterate

Fixes T8140. If a HandleList contained a null (because some caller sloppily added `null` as a handle), iteration (e.g., via `iterator_to_array()`) would abort prematurely.

In T8140, some of the project transactions add a `null` for an old file PHID when there's no old profile image.

Auditors: btrahan
This commit is contained in:
epriestley 2015-05-09 13:23:37 -07:00
parent 7668d47e6d
commit 8b7a4670f8

View file

@ -24,6 +24,7 @@ final class PhabricatorHandleList
private $handlePool;
private $phids;
private $count;
private $handles;
private $cursor;
private $map;
@ -35,6 +36,7 @@ final class PhabricatorHandleList
public function setPHIDs(array $phids) {
$this->phids = $phids;
$this->count = count($phids);
return $this;
}
@ -119,7 +121,7 @@ final class PhabricatorHandleList
}
public function valid() {
return isset($this->phids[$this->cursor]);
return ($this->cursor < $this->count);
}
@ -165,7 +167,7 @@ final class PhabricatorHandleList
public function count() {
return count($this->phids);
return $this->count;
}
}