Page MenuHomePhabricator

D21761.id51876.diff
No OneTemporary

D21761.id51876.diff

diff --git a/src/applications/diffusion/herald/HeraldCommitAdapter.php b/src/applications/diffusion/herald/HeraldCommitAdapter.php
--- a/src/applications/diffusion/herald/HeraldCommitAdapter.php
+++ b/src/applications/diffusion/herald/HeraldCommitAdapter.php
@@ -267,6 +267,11 @@
$raw = $diff_file->loadFileData();
+ // See T13667. This happens when a commit is empty and affects no files.
+ if (!strlen($raw)) {
+ return false;
+ }
+
$parser = new ArcanistDiffParser();
$changes = $parser->parseDiff($raw);
@@ -290,6 +295,10 @@
}
}
+ if ($this->commitDiff === false) {
+ return array();
+ }
+
if ($this->commitDiff instanceof Exception) {
$ex = $this->commitDiff;
$ex_class = get_class($ex);
diff --git a/src/applications/diffusion/query/pathchange/DiffusionPathChangeQuery.php b/src/applications/diffusion/query/pathchange/DiffusionPathChangeQuery.php
--- a/src/applications/diffusion/query/pathchange/DiffusionPathChangeQuery.php
+++ b/src/applications/diffusion/query/pathchange/DiffusionPathChangeQuery.php
@@ -88,7 +88,12 @@
$change->setFileType($raw_change['fileType']);
$change->setCommitIdentifier($commit->getCommitIdentifier());
- $change->setTargetPath(ltrim($raw_change['targetPathName'], '/'));
+ $target_path = $raw_change['targetPathName'];
+ if ($target_path !== null) {
+ $target_path = ltrim($target_path, '/');
+ }
+ $change->setTargetPath($target_path);
+
$change->setTargetCommitIdentifier($raw_change['targetCommitIdentifier']);
$id = $raw_change['pathID'];
diff --git a/src/applications/diffusion/request/DiffusionRequest.php b/src/applications/diffusion/request/DiffusionRequest.php
--- a/src/applications/diffusion/request/DiffusionRequest.php
+++ b/src/applications/diffusion/request/DiffusionRequest.php
@@ -207,7 +207,7 @@
*/
private function initializeFromDictionary(array $data) {
$blob = idx($data, 'blob');
- if (strlen($blob)) {
+ if (phutil_nonempty_string($blob)) {
$blob = self::parseRequestBlob($blob, $this->supportsBranches());
$data = $blob + $data;
}
diff --git a/src/applications/macro/query/PhabricatorMacroQuery.php b/src/applications/macro/query/PhabricatorMacroQuery.php
--- a/src/applications/macro/query/PhabricatorMacroQuery.php
+++ b/src/applications/macro/query/PhabricatorMacroQuery.php
@@ -128,7 +128,7 @@
$this->authorPHIDs);
}
- if (strlen($this->nameLike)) {
+ if (($this->nameLike !== null) && strlen($this->nameLike)) {
$where[] = qsprintf(
$conn,
'm.name LIKE %~',
@@ -142,7 +142,7 @@
$this->names);
}
- if (strlen($this->namePrefix)) {
+ if (($this->namePrefix !== null) && strlen($this->namePrefix)) {
$where[] = qsprintf(
$conn,
'm.name LIKE %>',
diff --git a/src/applications/repository/query/PhabricatorRepositoryQuery.php b/src/applications/repository/query/PhabricatorRepositoryQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryQuery.php
@@ -633,7 +633,7 @@
$this->uuids);
}
- if (strlen($this->datasourceQuery)) {
+ if (phutil_nonempty_string($this->datasourceQuery)) {
// This handles having "rP" match callsigns starting with "P...".
$query = trim($this->datasourceQuery);
if (preg_match('/^r/', $query)) {
diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -574,7 +574,7 @@
public function getURI() {
$short_name = $this->getRepositorySlug();
- if (strlen($short_name)) {
+ if (phutil_nonempty_string($short_name)) {
return "/source/{$short_name}/";
}
@@ -862,7 +862,7 @@
public function getDefaultBranch() {
$default = $this->getDetail('default-branch');
- if (strlen($default)) {
+ if (phutil_nonempty_string($default)) {
return $default;
}
diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php
--- a/src/infrastructure/markup/PhabricatorMarkupEngine.php
+++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php
@@ -583,6 +583,14 @@
$engine->setConfig('viewer', $viewer);
foreach ($content_blocks as $content_block) {
+ if ($content_block === null) {
+ continue;
+ }
+
+ if (!strlen($content_block)) {
+ continue;
+ }
+
$engine->markupText($content_block);
$phids = $engine->getTextMetadata(
PhabricatorMentionRemarkupRule::KEY_MENTIONED,
diff --git a/src/infrastructure/markup/render.php b/src/infrastructure/markup/render.php
--- a/src/infrastructure/markup/render.php
+++ b/src/infrastructure/markup/render.php
@@ -105,6 +105,10 @@
}
function phutil_escape_html($string) {
+ if ($string === null) {
+ return '';
+ }
+
if ($string instanceof PhutilSafeHTML) {
return $string;
} else if ($string instanceof PhutilSafeHTMLProducerInterface) {

File Metadata

Mime Type
text/plain
Expires
Sat, May 11, 5:35 PM (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6286545
Default Alt Text
D21761.id51876.diff (5 KB)

Event Timeline