Page MenuHomePhorge

D25268.1735314471.diff
No OneTemporary

D25268.1735314471.diff

diff --git a/src/applications/differential/customfield/DifferentialAuditorsField.php b/src/applications/differential/customfield/DifferentialAuditorsField.php
--- a/src/applications/differential/customfield/DifferentialAuditorsField.php
+++ b/src/applications/differential/customfield/DifferentialAuditorsField.php
@@ -21,7 +21,9 @@
public function setValueFromStorage($value) {
try {
- $this->setValue(phutil_json_decode($value));
+ if ($value != null) {
+ $this->setValue(phutil_json_decode($value));
+ }
} catch (PhutilJSONParserException $ex) {
$this->setValue(array());
}
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
@@ -39,11 +39,11 @@
$branch = $diff->getBranch();
$bookmark = $diff->getBookmark();
- if (strlen($branch) && strlen($bookmark)) {
+ if (phutil_nonempty_string($branch) && phutil_nonempty_string($bookmark)) {
return pht('%s (bookmark) on %s (branch)', $bookmark, $branch);
- } else if (strlen($bookmark)) {
+ } else if (phutil_nonempty_string($bookmark)) {
return pht('%s (bookmark)', $bookmark);
- } else if (strlen($branch)) {
+ } else if (phutil_nonempty_string($branch)) {
$onto = $diff->loadTargetBranch();
if (strlen($onto) && ($onto !== $branch)) {
return pht(
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -218,21 +218,23 @@
// No "$", to allow for branches like T123_demo.
$match = null;
- if (preg_match('/^T(\d+)/i', $branch, $match)) {
- $task_id = $match[1];
- $tasks = id(new ManiphestTaskQuery())
- ->setViewer($this->getActor())
- ->withIDs(array($task_id))
- ->execute();
- if ($tasks) {
- $task = head($tasks);
- $task_phid = $task->getPHID();
-
- $results[] = id(new DifferentialTransaction())
- ->setTransactionType($type_edge)
- ->setMetadataValue('edge:type', $edge_ref_task)
- ->setIgnoreOnNoEffect(true)
- ->setNewValue(array('+' => array($task_phid => $task_phid)));
+ if ($branch !== null && $match !== null) {
+ if (preg_match('/^T(\d+)/i', $branch, $match)) {
+ $task_id = $match[1];
+ $tasks = id(new ManiphestTaskQuery())
+ ->setViewer($this->getActor())
+ ->withIDs(array($task_id))
+ ->execute();
+ if ($tasks) {
+ $task = head($tasks);
+ $task_phid = $task->getPHID();
+
+ $results[] = id(new DifferentialTransaction())
+ ->setTransactionType($type_edge)
+ ->setMetadataValue('edge:type', $edge_ref_task)
+ ->setIgnoreOnNoEffect(true)
+ ->setNewValue(array('+' => array($task_phid => $task_phid)));
+ }
}
}
}
diff --git a/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php b/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php
--- a/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php
+++ b/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php
@@ -139,7 +139,7 @@
$not_applicable = '-';
$coverage = $this->getCoverage();
- if (!strlen($coverage)) {
+ if (!phutil_nonempty_string($coverage)) {
return $not_applicable;
}
@@ -157,7 +157,7 @@
$not_applicable = '-';
$coverage = $this->getCoverage();
- if (!strlen($coverage)) {
+ if (!phutil_nonempty_string($coverage)) {
return $not_applicable;
}
diff --git a/src/infrastructure/editor/PhabricatorEditorURIEngine.php b/src/infrastructure/editor/PhabricatorEditorURIEngine.php
--- a/src/infrastructure/editor/PhabricatorEditorURIEngine.php
+++ b/src/infrastructure/editor/PhabricatorEditorURIEngine.php
@@ -16,8 +16,10 @@
$pattern = $viewer->getUserSetting(PhabricatorEditorSetting::SETTINGKEY);
- if (!strlen(trim($pattern))) {
- return null;
+ if (!phutil_nonempty_string($pattern)) {
+ if (!phutil_nonempty_string(trim($pattern))) {
+ return null;
+ }
}
$engine = id(new self())
diff --git a/src/infrastructure/javelin/markup.php b/src/infrastructure/javelin/markup.php
--- a/src/infrastructure/javelin/markup.php
+++ b/src/infrastructure/javelin/markup.php
@@ -74,7 +74,7 @@
$body = array();
$http_method = idx($attributes, 'method');
- $is_post = (strcasecmp($http_method, 'POST') === 0);
+ $is_post = ($http_method !== null && strcasecmp($http_method, 'POST') === 0);
$http_action = idx($attributes, 'action');

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 15:47 (9 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1035237
Default Alt Text
D25268.1735314471.diff (5 KB)

Event Timeline