Page MenuHomePhabricator

D21873.diff
No OneTemporary

D21873.diff

diff --git a/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php b/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php
@@ -13,12 +13,12 @@
$e_name = true;
$v_engine = $request->getStr('engine');
- if (!strlen($v_engine)) {
+ if (!phutil_nonempty_string($v_engine)) {
$v_engine = $request->getURIData('engineKey');
}
$v_query = $request->getStr('query');
- if (!strlen($v_query)) {
+ if (!phutil_nonempty_string($v_query)) {
$v_query = $request->getURIData('queryKey');
}
diff --git a/src/applications/differential/customfield/DifferentialBranchField.php b/src/applications/differential/customfield/DifferentialBranchField.php
--- a/src/applications/differential/customfield/DifferentialBranchField.php
+++ b/src/applications/differential/customfield/DifferentialBranchField.php
@@ -36,15 +36,8 @@
}
private function getBranchDescription(DifferentialDiff $diff) {
- $branch = $diff->getBranch();
- $bookmark = $diff->getBookmark();
-
- if ($branch === null) {
- $branch = '';
- }
- if ($bookmark === null) {
- $bookmark = '';
- }
+ $branch = coalesce($diff->getBranch(), '');
+ $bookmark = coalesce($diff->getBookmark(), '');
if (strlen($branch) && strlen($bookmark)) {
return pht('%s (bookmark) on %s (branch)', $bookmark, $branch);
diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php
--- a/src/applications/diffusion/controller/DiffusionController.php
+++ b/src/applications/diffusion/controller/DiffusionController.php
@@ -153,7 +153,7 @@
if (!$spec['commit'] && !$spec['tags'] && !$spec['branches']) {
$branch_name = $drequest->getBranch();
- if (strlen($branch_name)) {
+ if ($branch_name !== null && strlen($branch_name)) {
$repository_name .= ' ('.$branch_name.')';
}
}
diff --git a/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php b/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php
--- a/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php
+++ b/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php
@@ -102,7 +102,7 @@
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
$ref = $this->getCommitRef();
$author = $ref->getAuthor();
- if (!strlen($author)) {
+ if ($author === null || !strlen($author)) {
return null;
}
return $this->lookupUser($author);
@@ -123,7 +123,7 @@
// can't resolve it, return `null`.
$ref = $this->getCommitRef();
$committer = $ref->getCommitter();
- if (!strlen($committer)) {
+ if ($committer === null || !strlen($committer)) {
return $this->getAuthorPHID();
}
return $this->lookupUser($committer);
@@ -157,7 +157,7 @@
// instead.
$ref = $this->getCommitRef();
$committer = $ref->getCommitter();
- if (strlen($committer)) {
+ if ($committer !== null && strlen($committer)) {
return $committer;
}
return $ref->getAuthor();
diff --git a/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php b/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php
--- a/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php
+++ b/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php
@@ -41,7 +41,7 @@
$parts[] = $name;
$slug = $repository->getRepositorySlug();
- if (strlen($slug)) {
+ if ($slug !== null && strlen($slug)) {
$parts[] = $slug;
}
diff --git a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
--- a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
@@ -249,7 +249,7 @@
$root_key = 'workingcopy.root';
$root = $resource->getAttribute($root_key);
- if (strlen($root)) {
+ if ($root !== null && strlen($root)) {
$interface->execx('rm -rf -- %s', $root);
}
}
diff --git a/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
--- a/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
@@ -65,7 +65,7 @@
foreach ($messages as $message_key => $message) {
if ($args->getArg('dump-html')) {
$html_body = $message->getHTMLBody();
- if (strlen($html_body)) {
+ if ($html_body !== null && strlen($html_body)) {
$template =
"<!doctype html><html><body>{$html_body}</body></html>";
$console->writeOut("%s\n", $html_body);
@@ -188,8 +188,9 @@
$info[] = null;
$info[] = $this->newSectionHeader(pht('TEXT BODY'));
- if (strlen($message->getBody())) {
- $info[] = tsprintf('%B', $message->getBody());
+ $message_body = $message->getBody();
+ if ($message_body !== null && strlen($message_body)) {
+ $info[] = tsprintf('%B', $message_body);
} else {
$info[] = pht('(This message has no text body.)');
}
@@ -203,8 +204,9 @@
$info[] = null;
$info[] = $this->newSectionHeader(pht('HTML BODY'));
- if (strlen($message->getHTMLBody())) {
- $info[] = $message->getHTMLBody();
+ $message_html_body = $message->getHTMLBody();
+ if ($message_html_body !== null && strlen($message_html_body)) {
+ $info[] = $message_html_body;
$info[] = null;
} else {
$info[] = pht('(This message has no HTML body.)');
diff --git a/src/applications/repository/xaction/PhabricatorRepositoryDefaultBranchTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryDefaultBranchTransaction.php
--- a/src/applications/repository/xaction/PhabricatorRepositoryDefaultBranchTransaction.php
+++ b/src/applications/repository/xaction/PhabricatorRepositoryDefaultBranchTransaction.php
@@ -17,12 +17,12 @@
$old = $this->getOldValue();
$new = $this->getNewValue();
- if (!strlen($new)) {
+ if ($new === null || !strlen($new)) {
return pht(
'%s removed %s as the default branch.',
$this->renderAuthor(),
$this->renderOldValue());
- } else if (!strlen($old)) {
+ } else if ($old === null || !strlen($old)) {
return pht(
'%s set the default branch to %s.',
$this->renderAuthor(),
diff --git a/src/applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php
--- a/src/applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php
+++ b/src/applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php
@@ -52,7 +52,7 @@
foreach ($xactions as $xaction) {
$old = $xaction->getOldValue();
$new = $xaction->getNewValue();
- if (!strlen($new)) {
+ if ($new === null || !strlen($new)) {
continue;
}
diff --git a/src/applications/repository/xaction/PhabricatorRepositorySVNSubpathTransaction.php b/src/applications/repository/xaction/PhabricatorRepositorySVNSubpathTransaction.php
--- a/src/applications/repository/xaction/PhabricatorRepositorySVNSubpathTransaction.php
+++ b/src/applications/repository/xaction/PhabricatorRepositorySVNSubpathTransaction.php
@@ -17,12 +17,12 @@
$old = $this->getOldValue();
$new = $this->getNewValue();
- if (!strlen($new)) {
+ if ($new === null || !strlen($new)) {
return pht(
'%s removed %s as the "Import Only" path.',
$this->renderAuthor(),
$this->renderOldValue());
- } else if (!strlen($old)) {
+ } else if ($old === null || !strlen($old)) {
return pht(
'%s set the repository "Import Only" path to %s.',
$this->renderAuthor(),
diff --git a/src/applications/repository/xaction/PhabricatorRepositoryStagingURITransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryStagingURITransaction.php
--- a/src/applications/repository/xaction/PhabricatorRepositoryStagingURITransaction.php
+++ b/src/applications/repository/xaction/PhabricatorRepositoryStagingURITransaction.php
@@ -17,12 +17,12 @@
$old = $this->getOldValue();
$new = $this->getNewValue();
- if (!strlen($old)) {
+ if ($old === null || !strlen($old)) {
return pht(
'%s set %s as the staging area for this repository.',
$this->renderAuthor(),
$this->renderNewValue());
- } else if (!strlen($new)) {
+ } else if ($new === null || !strlen($new)) {
return pht(
'%s removed %s as the staging area for this repository.',
$this->renderAuthor(),
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
@@ -301,7 +301,7 @@
}
public function renderPropertyViewValue(array $handles) {
- if (!strlen($this->getFieldValue())) {
+ if ($this->getFieldValue() === null || !strlen($this->getFieldValue())) {
return null;
}
return $this->getFieldValue();
@@ -389,7 +389,7 @@
if (is_array($value)) {
return empty($value);
}
- return !strlen($value);
+ return $value === null || !strlen($value);
}
public function getApplicationTransactionTitle(
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php
@@ -11,7 +11,7 @@
$indexes = array();
$value = $this->getFieldValue();
- if (strlen($value)) {
+ if ($value !== null && strlen($value)) {
$indexes[] = $this->newNumericIndex((int)$value);
}
@@ -32,7 +32,7 @@
}
public function setValueFromStorage($value) {
- if (strlen($value)) {
+ if ($value !== null && strlen($value)) {
$value = (int)$value;
} else {
$value = null;
@@ -52,7 +52,7 @@
PhabricatorCursorPagedPolicyAwareQuery $query,
$value) {
- if (strlen($value)) {
+ if ($value !== null && strlen($value)) {
$query->withApplicationSearchContainsConstraint(
$this->newNumericIndex(null),
$value);
@@ -83,7 +83,7 @@
foreach ($xactions as $xaction) {
$value = $xaction->getNewValue();
- if (strlen($value)) {
+ if ($value !== null && strlen($value)) {
if (!preg_match('/^-?\d+/', $value)) {
$errors[] = new PhabricatorApplicationTransactionValidationError(
$type,
@@ -103,9 +103,11 @@
$old = $xaction->getOldValue();
$new = $xaction->getNewValue();
- if (!strlen($old) && strlen($new)) {
+ if (($old == null || !strlen($old))
+ && ($new !== null && strlen($new))) {
return true;
- } else if (strlen($old) && !strlen($new)) {
+ } else if (($old !== null && strlen($old))
+ && ($new === null || !strlen($new))) {
return true;
} else {
return ((int)$old !== (int)$new);
diff --git a/src/view/form/control/AphrontFormDateControlValue.php b/src/view/form/control/AphrontFormDateControlValue.php
--- a/src/view/form/control/AphrontFormDateControlValue.php
+++ b/src/view/form/control/AphrontFormDateControlValue.php
@@ -347,6 +347,10 @@
'midnight' => '12:00 AM',
);
+ if ($time === null || !strlen($time)) {
+ return $time;
+ }
+
$normalized = phutil_utf8_strtolower($time);
if (isset($colloquial[$normalized])) {
$time = $colloquial[$normalized];
diff --git a/src/view/phui/PHUISegmentBarSegmentView.php b/src/view/phui/PHUISegmentBarSegmentView.php
--- a/src/view/phui/PHUISegmentBarSegmentView.php
+++ b/src/view/phui/PHUISegmentBarSegmentView.php
@@ -55,7 +55,7 @@
$left = sprintf('%.2f%%', $left);
$tooltip = $this->tooltip;
- if (strlen($tooltip)) {
+ if ($tooltip !== null && strlen($tooltip)) {
Javelin::initBehavior('phabricator-tooltips');
$sigil = 'has-tooltip';

File Metadata

Mime Type
text/plain
Expires
Tue, May 14, 6:04 AM (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6284805
Default Alt Text
D21873.diff (12 KB)

Event Timeline