diff --git a/src/browse/query/ArcanistBrowseObjectNameURIHardpointQuery.php b/src/browse/query/ArcanistBrowseObjectNameURIHardpointQuery.php --- a/src/browse/query/ArcanistBrowseObjectNameURIHardpointQuery.php +++ b/src/browse/query/ArcanistBrowseObjectNameURIHardpointQuery.php @@ -15,7 +15,7 @@ $token_set = array(); foreach ($refs as $key => $ref) { $token = $ref->getToken(); - if (!strlen($token)) { + if ($token === null || !strlen($token)) { continue; } diff --git a/src/lint/linter/ArcanistCppcheckLinter.php b/src/lint/linter/ArcanistCppcheckLinter.php --- a/src/lint/linter/ArcanistCppcheckLinter.php +++ b/src/lint/linter/ArcanistCppcheckLinter.php @@ -35,7 +35,7 @@ list($stdout) = execx('%C --version', $this->getExecutableCommand()); $matches = array(); - $regex = '/^Cppcheck (?P\d+\.\d+)$/'; + $regex = '/^Cppcheck (?P\d+\.\d+(\.\d+)?)$/'; if (preg_match($regex, $stdout, $matches)) { return $matches['version']; } else { diff --git a/src/lint/linter/ArcanistScriptAndRegexLinter.php b/src/lint/linter/ArcanistScriptAndRegexLinter.php --- a/src/lint/linter/ArcanistScriptAndRegexLinter.php +++ b/src/lint/linter/ArcanistScriptAndRegexLinter.php @@ -204,7 +204,7 @@ */ public function lintPath($path) { $output = idx($this->output, $path); - if (!strlen($output)) { + if ($output === null || !strlen($output)) { // No output, but it exited 0, so just move on. return; } @@ -338,7 +338,7 @@ } $line = idx($match, 'line'); - if (strlen($line)) { + if ($line !== null && strlen($line)) { $line = (int)$line; if (!$line) { $line = 1; @@ -376,7 +376,11 @@ 'disabled' => ArcanistLintSeverity::SEVERITY_DISABLED, ); - $severity_name = strtolower(idx($match, 'severity')); + $severity_name = idx($match, 'severity'); + if ($severity_name === null || !strlen($severity_name)) { + return ArcanistLintSeverity::SEVERITY_ERROR; + } + $severity_name = strtolower($severity_name); foreach ($map as $name => $severity) { if (!empty($match[$name])) { diff --git a/src/ref/ArcanistRefView.php b/src/ref/ArcanistRefView.php --- a/src/ref/ArcanistRefView.php +++ b/src/ref/ArcanistRefView.php @@ -98,12 +98,14 @@ // TODO: This should truncate based on console display width, not // glyphs, but there's currently no "setMaximumConsoleCharacterWidth()". - $title = id(new PhutilUTF8StringTruncator()) - ->setMaximumGlyphs($usable_width) - ->truncateString($title); + if ($title !== null && strlen($title)) { + $title = id(new PhutilUTF8StringTruncator()) + ->setMaximumGlyphs($usable_width) + ->truncateString($title); + } if ($object_name !== null) { - if (strlen($title)) { + if ($title !== null && strlen($title)) { $display_text = tsprintf('**%s** %s', $object_name, $title); } else { $display_text = tsprintf('**%s**', $object_name); diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -1143,7 +1143,7 @@ public function hasLocalCommit($commit) { try { - if (!$this->getCanonicalRevisionName($commit)) { + if ($commit === null || !$this->getCanonicalRevisionName($commit)) { return false; } } catch (CommandException $exception) { diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php --- a/src/workflow/ArcanistWorkflow.php +++ b/src/workflow/ArcanistWorkflow.php @@ -480,7 +480,7 @@ // token-based authentication. Use that instead of all the certificate // stuff. $token = idx($credentials, 'token'); - if (strlen($token)) { + if ($token !== null && strlen($token)) { $conduit = $this->getConduit(); $conduit->setConduitToken($token); @@ -2245,7 +2245,7 @@ $map = $this->getModernCommonDictionary($map); $details = idx($map, 'userData'); - if (strlen($details)) { + if ($details !== null && strlen($details)) { $map['details'] = (string)$details; } unset($map['userData']);