Skip to content

Commit ce3d484

Browse files
committed
Addressing some PHP8 incompatibilities - Diffusion & Differential
Summary: Running through setting up and using Diffusion repositories and addressing PHP8 issues that come up. Test Plan: I set up a hosted mercurial repository and pushed commits to it over ssh. I set up a hosted git repository and pushed commits to it over ssh. I set up a mirrored mercurial repository over ssh. I set up a mirrored git repository over ssh. I created a diff on a git repository and landed it. I created a diff on a mercurial repository and landed it. I cloned and pushed a commit to a mercurial repo over http. I cloned and pushed a commit to a git repo over http. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D21864
1 parent 5899526 commit ce3d484

File tree

51 files changed

+151
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+151
-83
lines changed

scripts/ssh/ssh-auth.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
$authstruct = null;
3838

39-
if (strlen($authstruct_raw)) {
39+
if ($authstruct_raw !== null && strlen($authstruct_raw)) {
4040
try {
4141
$authstruct = phutil_json_decode($authstruct_raw);
4242
} catch (Exception $ex) {
@@ -135,7 +135,7 @@
135135

136136
$cmd = csprintf('%s %Ls', $bin, $key_argv);
137137

138-
if (strlen($instance)) {
138+
if ($instance !== null && strlen($instance)) {
139139
$cmd = csprintf('PHABRICATOR_INSTANCE=%s %C', $instance, $cmd);
140140
}
141141

src/applications/almanac/util/AlmanacKeys.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function getLiveDevice() {
5858

5959
public static function getClusterSSHUser() {
6060
$username = PhabricatorEnv::getEnvConfig('diffusion.ssh-user');
61-
if (strlen($username)) {
61+
if ($username !== null && strlen($username)) {
6262
return $username;
6363
}
6464

src/applications/conduit/query/PhabricatorConduitSearchEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
3939
$query->withIsInternal(false);
4040

4141
$contains = $saved->getParameter('nameContains');
42-
if (strlen($contains)) {
42+
if ($contains !== null && strlen($contains)) {
4343
$query->withNameContains($contains);
4444
}
4545

src/applications/config/controller/module/PhabricatorConfigModuleController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public function handleRequest(AphrontRequest $request) {
99

1010
$all_modules = PhabricatorConfigModule::getAllModules();
1111

12-
if (!strlen($key)) {
12+
if ($key === null || !strlen($key)) {
1313
$key = head_key($all_modules);
1414
}
1515

src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function execute(ConduitAPIRequest $request) {
5656
// show "Field:" templates for some fields even if they are empty.
5757
$edit_mode = $request->getValue('edit');
5858

59-
$is_any_edit = (bool)strlen($edit_mode);
59+
$is_any_edit = $edit_mode !== null && (bool)strlen($edit_mode);
6060
$is_create = ($edit_mode == 'create');
6161

6262
$field_list = DifferentialCommitMessageField::newEnabledFields($viewer);
@@ -115,7 +115,7 @@ protected function execute(ConduitAPIRequest $request) {
115115

116116
$is_title = ($field_key == $key_title);
117117

118-
if (!strlen($value)) {
118+
if ($value === null || !strlen($value)) {
119119
if ($is_template) {
120120
$commit_message[] = $label.': ';
121121
}

src/applications/differential/customfield/DifferentialBranchField.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,20 @@ private function getBranchDescription(DifferentialDiff $diff) {
3939
$branch = $diff->getBranch();
4040
$bookmark = $diff->getBookmark();
4141

42+
if ($branch === null) {
43+
$branch = '';
44+
}
45+
if ($bookmark === null) {
46+
$bookmark = '';
47+
}
48+
4249
if (strlen($branch) && strlen($bookmark)) {
4350
return pht('%s (bookmark) on %s (branch)', $bookmark, $branch);
4451
} else if (strlen($bookmark)) {
4552
return pht('%s (bookmark)', $bookmark);
4653
} else if (strlen($branch)) {
4754
$onto = $diff->loadTargetBranch();
48-
if (strlen($onto) && ($onto !== $branch)) {
55+
if ($onto !== null && strlen($onto) && ($onto !== $branch)) {
4956
return pht(
5057
'%s (branched from %s)',
5158
$branch,

src/applications/differential/field/DifferentialCommitMessageField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function readFieldValueFromObject(DifferentialRevision $revision) {
6060
}
6161

6262
public function renderFieldValue($value) {
63-
if (!strlen($value)) {
63+
if ($value === null || !strlen($value)) {
6464
return null;
6565
}
6666

src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function readFieldValueFromConduit($value) {
7272
}
7373

7474
public function renderFieldValue($value) {
75-
if (!strlen($value)) {
75+
if ($value === null || !strlen($value)) {
7676
return null;
7777
}
7878

src/applications/differential/storage/DifferentialChangeset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public function getDiff() {
325325

326326
public function getOldStatePathVector() {
327327
$path = $this->getOldFile();
328-
if (!strlen($path)) {
328+
if ($path === null || !strlen($path)) {
329329
$path = $this->getFilename();
330330
}
331331

src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ public function render() {
251251
$content = phabricator_form(
252252
$this->getUser(),
253253
array(
254+
'method' => 'GET',
254255
'action' => '/D'.$revision_id.'#toc',
255256
),
256257
array(

0 commit comments

Comments
 (0)