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

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.

```
PhabricatorRepositorySlugTransaction.php:28: strlen(): Passing null to parameter #1 ($string) of type string is deprecated
PhabricatorRepositorySlugTransaction.php:32: strlen(): Passing null to parameter #1 ($string) of type string is deprecated
```

Refs T16468

Test Plan: None; probably rename a repository slug.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16468

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

+3 -3
+3 -3
src/applications/repository/xaction/PhabricatorRepositorySlugTransaction.php
··· 25 25 $old = $this->getOldValue(); 26 26 $new = $this->getNewValue(); 27 27 28 - if (strlen($old) && !strlen($new)) { 28 + if (phutil_nonempty_string($old) && !phutil_nonempty_string($new)) { 29 29 return pht( 30 30 '%s removed the short name of this repository.', 31 31 $this->renderAuthor()); 32 - } else if (strlen($new) && !strlen($old)) { 32 + } else if (phutil_nonempty_string($new) && !phutil_nonempty_string($old)) { 33 33 return pht( 34 34 '%s set the short name of this repository to %s.', 35 35 $this->renderAuthor(), ··· 50 50 $old = $xaction->getOldValue(); 51 51 $new = $xaction->getNewValue(); 52 52 53 - if (!strlen($new)) { 53 + if (!phutil_nonempty_string($new)) { 54 54 continue; 55 55 } 56 56