1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 08:12:40 +01:00

Fix early exit from getMatchSeverity on null severity

Summary:
In PHP 8.1, the strtolower() function no longer accepts NULL.

Without this change, getMatchSeverity() exits early if there is no severity found.

Closes T15257
Ref T15190

Test Plan: I ran this with an arc linter on a private repository which doesn't have a regex to match severity

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15257, T15190

Differential Revision: https://we.phorge.it/D25126
This commit is contained in:
rgodden 2023-04-19 10:47:55 +01:00
parent f4a639944d
commit 75af13abe9

View file

@ -203,7 +203,7 @@ final class ArcanistScriptAndRegexLinter extends ArcanistLinter {
* @task lint * @task lint
*/ */
public function lintPath($path) { public function lintPath($path) {
$output = idx($this->output, $path); $output = idx($this->output, $path, '');
if (!strlen($output)) { if (!strlen($output)) {
// No output, but it exited 0, so just move on. // No output, but it exited 0, so just move on.
return; return;
@ -337,7 +337,7 @@ final class ArcanistScriptAndRegexLinter extends ArcanistLinter {
return array($line + 1, $char + 1); return array($line + 1, $char + 1);
} }
$line = idx($match, 'line'); $line = idx($match, 'line', '');
if (strlen($line)) { if (strlen($line)) {
$line = (int)$line; $line = (int)$line;
if (!$line) { if (!$line) {
@ -376,7 +376,7 @@ final class ArcanistScriptAndRegexLinter extends ArcanistLinter {
'disabled' => ArcanistLintSeverity::SEVERITY_DISABLED, 'disabled' => ArcanistLintSeverity::SEVERITY_DISABLED,
); );
$severity_name = strtolower(idx($match, 'severity')); $severity_name = strtolower(idx($match, 'severity', ''));
foreach ($map as $name => $severity) { foreach ($map as $name => $severity) {
if (!empty($match[$name])) { if (!empty($match[$name])) {