@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.

Explicitly cast "limit" (page size) API parameter to int

Summary:
Do not throw an exception when the `limit` (page size) Conduit API parameter is a float but explicitly convert to int.
As an admin, I am not interested in having invalid user-committed query data trigger an error in the server logs.

```
ERROR 8192: Implicit conversion from float to int loses precision at [/var/www/html/phorge/phorge/src/view/control/AphrontCursorPagerView.php:76]
```

Closes T15810

Test Plan: Call `/conduit/method/maniphest.search/` with a float value for the `limit` field. Check the server logs or DarkConsole.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15810

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

+3 -2
+3 -2
src/view/control/AphrontCursorPagerView.php
··· 72 72 73 73 public function sliceResults(array $results) { 74 74 if (count($results) > $this->getPageSize()) { 75 - $offset = ($this->beforeID ? count($results) - $this->getPageSize() : 0); 76 - $results = array_slice($results, $offset, $this->getPageSize(), true); 75 + $page_size = (int)$this->getPageSize(); 76 + $offset = ($this->beforeID ? count($results) - $page_size : 0); 77 + $results = array_slice($results, $offset, $page_size, true); 77 78 $this->moreResults = true; 78 79 } 79 80 return $results;