mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 00:02:40 +01:00
Fix a PHP 8.1/8.2 deprecated use of strlen deprecated call with a NULL argument
Summary: This strlen call triggering an exception if an user tried to call the patch command without an authentication token Indeed, strlen() was used in Phabricator to check if a generic value is a non-empty string. This behavior is deprecated since PHP 8.1, we use phutil_nonempty_string() as a replacement. Fix T15599 Test Plan: Remove your arcanist authentication token file (if you have one) and try to call the patch command in a repository. You should get an error message suggesting you to call the install-certificate command instead of an exception. Reviewers: O1 Blessed Committers, Matthew Reviewed By: O1 Blessed Committers, Matthew Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15599 Differential Revision: https://we.phorge.it/D25383
This commit is contained in:
parent
6832afc300
commit
df6c315ace
1 changed files with 4 additions and 4 deletions
|
@ -479,8 +479,8 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
// If we have `token`, this server supports the simpler, new-style
|
// If we have `token`, this server supports the simpler, new-style
|
||||||
// token-based authentication. Use that instead of all the certificate
|
// token-based authentication. Use that instead of all the certificate
|
||||||
// stuff.
|
// stuff.
|
||||||
$token = idx($credentials, 'token', '');
|
$token = idx($credentials, 'token');
|
||||||
if (strlen($token)) {
|
if (phutil_nonempty_string($token)) {
|
||||||
$conduit = $this->getConduit();
|
$conduit = $this->getConduit();
|
||||||
|
|
||||||
$conduit->setConduitToken($token);
|
$conduit->setConduitToken($token);
|
||||||
|
@ -2244,8 +2244,8 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
protected function getModernUnitDictionary(array $map) {
|
protected function getModernUnitDictionary(array $map) {
|
||||||
$map = $this->getModernCommonDictionary($map);
|
$map = $this->getModernCommonDictionary($map);
|
||||||
|
|
||||||
$details = idx($map, 'userData', '');
|
$details = idx($map, 'userData');
|
||||||
if (strlen($details)) {
|
if (phutil_nonempty_string($details)) {
|
||||||
$map['details'] = (string)$details;
|
$map['details'] = (string)$details;
|
||||||
}
|
}
|
||||||
unset($map['userData']);
|
unset($map['userData']);
|
||||||
|
|
Loading…
Reference in a new issue