1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 10:12:41 +01:00

Fix an exception in cursor pagination of Conpherence threads

Summary: Ref T13680. Conpherence may pass values with an integer type to this layer of the stack. These are "supposed" to be strings, but just be accepting.

Test Plan:
  - Wrote 100+ messages to a Conpherence room.
  - Clicked "Show Older Messages".
  - Before: exception, int passed to "phutil_nonempty_string()".
  - After: older messages loaded.

Maniphest Tasks: T13680

Differential Revision: https://secure.phabricator.com/D21824
This commit is contained in:
epriestley 2022-05-17 16:07:13 -07:00
parent 431612023d
commit 147b48b934

View file

@ -369,10 +369,13 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
$this->setLimit($limit + 1);
if (phutil_nonempty_string($pager->getAfterID())) {
$this->setExternalCursorString($pager->getAfterID());
} else if ($pager->getBeforeID()) {
$this->setExternalCursorString($pager->getBeforeID());
$after_id = phutil_string_cast($pager->getAfterID());
$before_id = phutil_string_cast($pager->getBeforeID());
if (phutil_nonempty_string($after_id)) {
$this->setExternalCursorString($after_id);
} else if (phutil_nonempty_string($before_id)) {
$this->setExternalCursorString($before_id);
$this->setIsQueryOrderReversed(true);
}