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

Conduit: Fix PHP 8.1 "trim(null)" exception in conduit.getcertificate

Summary:
Passing null to `trim()` is deprecated since PHP 8.1.

```
ERROR 8192: trim(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php:55]
```

Closes T16423

Test Plan:
* PHP 8.1+
* Go to http://phorge.localhost/conduit/method/conduit.getcertificate/
* Press the "Call Method" button

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16423

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

+6 -3
+6 -3
src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php
··· 49 49 throw new ConduitException('ERR-RATE-LIMIT'); 50 50 } 51 51 52 + $info = null; 52 53 $token = $request->getValue('token'); 53 - $info = id(new PhabricatorConduitCertificateToken())->loadOneWhere( 54 - 'token = %s', 55 - trim($token)); 54 + if ($token !== null) { 55 + $info = id(new PhabricatorConduitCertificateToken())->loadOneWhere( 56 + 'token = %s', 57 + trim($token)); 58 + } 56 59 57 60 if (!$info || $info->getDateCreated() < time() - (60 * 15)) { 58 61 $this->logFailure($request, $info);