mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +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:
parent
7668d47e6d
commit
8b7a4670f8
1 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue