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

Fix error in Mercurial when no offset is specified

Summary:
When viewing the history of a Mercurial diffusion repository the server return a 500. This is
because a function call to array_slice requires the offset to be set to an integer. So when it is
not specified it can be set to 0 as a default.

The error is as follows:

```
ERROR 8192: array_slice(): Passing null to parameter #2 ($offset) of type int is deprecated at [/usr/local/www/phorge/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php:167]; PHP message: arcanist(head=master, ref.master=3cb117684f4e), phorge(head=master, ref.master=4bf5c452eb28); PHP message: #0 array_slice(array, NULL) called at [<phorge>/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php:167]
```

Test Plan: The history tab should not return a 500 when not specifying an offset

Reviewers: O1 Blessed Committers, valerio.bozzolan, speck

Reviewed By: O1 Blessed Committers, valerio.bozzolan, speck

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

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

authored by

Andre Klapper and committed by
Jeffrey Gelens
dbcc4472 7429da91

+2 -2
+2 -2
src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php
··· 24 24 'commit' => 'required string', 25 25 'against' => 'optional string', 26 26 'path' => 'required string', 27 - 'offset' => 'required int', 27 + 'offset' => 'optional int', 28 28 'limit' => 'required int', 29 29 'needDirectChanges' => 'optional bool', 30 30 'needChildChanges' => 'optional bool', ··· 109 109 $repository = $drequest->getRepository(); 110 110 $commit_hash = $request->getValue('commit'); 111 111 $path = $request->getValue('path'); 112 - $offset = $request->getValue('offset'); 112 + $offset = $request->getValue('offset', 0); 113 113 $limit = $request->getValue('limit'); 114 114 115 115 $path = DiffusionPathIDQuery::normalizePath($path);