Page MenuHomePhabricator

D21865.id52123.diff
No OneTemporary

D21865.id52123.diff

diff --git a/src/future/http/status/HTTPFutureHTTPResponseStatus.php b/src/future/http/status/HTTPFutureHTTPResponseStatus.php
--- a/src/future/http/status/HTTPFutureHTTPResponseStatus.php
+++ b/src/future/http/status/HTTPFutureHTTPResponseStatus.php
@@ -21,7 +21,8 @@
$content_type = BaseHTTPFuture::getHeader($headers, 'Content-Type');
$match = null;
- if (preg_match('/;\s*charset=([^;]+)/', $content_type, $match)) {
+ if ($content_type !== null && strlen($content_type)
+ && preg_match('/;\s*charset=([^;]+)/', $content_type, $match)) {
$encoding = trim($match[1], "\"'");
try {
$excerpt = phutil_utf8_convert($excerpt, 'UTF-8', $encoding);
diff --git a/src/parser/ArcanistBundle.php b/src/parser/ArcanistBundle.php
--- a/src/parser/ArcanistBundle.php
+++ b/src/parser/ArcanistBundle.php
@@ -795,13 +795,13 @@
$new_data = $this->getBlob($new_phid, $name);
}
- $new_length = strlen($new_data);
- $this->reserveBytes($new_length * 5 / 4);
-
if ($new_data === null) {
+ $new_length = 0;
$new_data = '';
$new_sha1 = str_repeat('0', 40);
} else {
+ $new_length = strlen($new_data);
+ $this->reserveBytes($new_length * 5 / 4);
$new_sha1 = sha1("blob {$new_length}\0{$new_data}");
}
diff --git a/src/parser/ArcanistDiffParser.php b/src/parser/ArcanistDiffParser.php
--- a/src/parser/ArcanistDiffParser.php
+++ b/src/parser/ArcanistDiffParser.php
@@ -263,7 +263,9 @@
// searching for "diff -r" or "diff --git" in the text.
$this->saveLine();
$line = $this->nextLineThatLooksLikeDiffStart();
- if (!$this->tryMatchHeader($patterns, $line, $match)) {
+ if ($line === null
+ || !$this->tryMatchHeader($patterns, $line, $match)) {
+
// Restore line before guessing to display correct error.
$this->restoreLine();
$failed_parse = true;

File Metadata

Mime Type
text/plain
Expires
Sun, Jun 23, 7:30 AM (4 d, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6311484
Default Alt Text
D21865.id52123.diff (1 KB)

Event Timeline