1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 10:12:41 +01:00

fix PHP 8 "strlen(null)" when moving paths with missing options

Summary:
Running ./bin/repository move-paths without specifying --from nor --to
leads to the PHP 8 error about strlen() not accepting null parameters.

Test Plan: Running ./bin/repository move-paths without --from/--to (shows a proper error)

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan

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

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

Differential Revision: https://we.phorge.it/D25484
This commit is contained in:
Jean Guyomarc'h 2024-02-12 11:04:29 +01:00 committed by Valerio Bozzolan
parent f81e821abf
commit a7fb04f96c

View file

@ -38,14 +38,14 @@ final class PhabricatorRepositoryManagementMovePathsWorkflow
} }
$from = $args->getArg('from'); $from = $args->getArg('from');
if (!strlen($from)) { if (!phutil_nonempty_string($from)) {
throw new Exception( throw new Exception(
pht( pht(
'You must specify a path prefix to move from with --from.')); 'You must specify a path prefix to move from with --from.'));
} }
$to = $args->getArg('to'); $to = $args->getArg('to');
if (!strlen($to)) { if (!phutil_nonempty_string($to)) {
throw new Exception( throw new Exception(
pht( pht(
'You must specify a path prefix to move to with --to.')); 'You must specify a path prefix to move to with --to.'));