1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Fix a PHP 8.1 deprecated use of strlen with a NULL argument

Summary:
This call is preventing users to browse Subversion repositories.
Using strlen() to check string validity 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.

Fix T15608

Test Plan:
- Sign in
- Open a Diffusion SVN repository
- You should see the repository instead of getting a Runtime Exception

Reviewers: O1 Blessed Committers, Sten, avivey

Reviewed By: O1 Blessed Committers, Sten, avivey

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

Maniphest Tasks: T15608

Differential Revision: https://we.phorge.it/D25398
This commit is contained in:
bob 2023-08-18 15:49:32 +02:00
parent 6ec89e9f08
commit 8876f75fbb

View file

@ -508,7 +508,7 @@ final class DiffusionRepositoryController extends DiffusionController {
$repository_name = $repository->getName();
$branch_name = $drequest->getBranch();
if (strlen($branch_name)) {
if (phutil_nonempty_string($branch_name)) {
$repository_name .= ' ('.$branch_name.')';
}