@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 PHP 8.1 "strlen(null)" exceptions in /bin/auth revoke

Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php:122]
```
Closes T16227

Test Plan:
* Run `./bin/auth revoke --type ssh`
* Run `./bin/auth revoke --type '' --everything`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16227

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

+3 -3
+3 -3
src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php
··· 71 71 '"--everything". Use "--list" to list available credential '. 72 72 'types.')); 73 73 } 74 - } else if (strlen($type) && $is_everything) { 74 + } else if (phutil_nonempty_string($type) && $is_everything) { 75 75 throw new PhutilArgumentUsageException( 76 76 pht( 77 77 'Specify the credential type to revoke with "--type" or '. ··· 119 119 } 120 120 121 121 $target = null; 122 - if (!strlen($from) && !$is_everywhere) { 122 + if (!phutil_nonempty_string($from) && !$is_everywhere) { 123 123 throw new PhutilArgumentUsageException( 124 124 pht( 125 125 'Specify the target to revoke credentials from with "--from" or '. 126 126 'specify "--everywhere".')); 127 - } else if (strlen($from) && $is_everywhere) { 127 + } else if (phutil_nonempty_string($from) && $is_everywhere) { 128 128 throw new PhutilArgumentUsageException( 129 129 pht( 130 130 'Specify the target to revoke credentials from with "--from" or '.