PhabricatorFeedQuery::withEpochInRange() returns zero results when passing parameters in the wrong order.
Instead return a PhutilArgumentUsageException which makes it clear why there are no results.
Details
- Reviewers
valerio.bozzolan - Group Reviewers
O1: Blessed Committers - Commits
- rPabeeadd6b013: Check that min epoch < max epoch in PhabricatorFeedQuery::withEpochInRange()
On an early morning without coffee supply, write custom code like
$query = id(new PhabricatorFeedQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) ->withFilterPHIDs(array($user->getPHID())) ->withEpochInRange(time(), time() - 86400) ->setReturnPartialResultsOnOverheat(true); $stories = $query->execute();
and wonder why you get zero results. Optionally, feel stupid for a moment.
Apply patch, now get an "Unhandled Exception ("PhutilArgumentUsageException") - Minimum range must be lower than maximum range."
Diff Detail
- Repository
- rP Phorge
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
src/applications/feed/query/PhabricatorFeedQuery.php | ||
---|---|---|
26 | Maybe this, to support null on one, or on the other, from unknown usages / unknown resetters |
Uh, nice thought! Phorge accepts and handles correctly one or two parameters being null which I think is fine as-is, so I'd only check for switched parameters created by confused developers here.
Alright, even after calling ->withEpochInRange(null, null) this very code change (comparing null with null) works fine without a problem, so I'd not add that additional null check
I don't know if anybody is supposed to run
->withEpochInRange(time(), null)
Technically the backend was supporting that, and time > null is true so generates that new exception