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

Fix DifferentialGetCommitMessageConduitAPIMethod execute strlen(null)

Summary:
When iterating through the fields of a differential commit, the DifferentialGetCommitMessageConduitAPIMethod execute method explicitly allows a value to be either a string or a null. It then calls strlen upon this possibly null value.

We could replace the strlen with phutil_nonempty_string, but as the code has already eliminated variable types other than string or null, it is more efficient to explicitly check for null or ''
```
$value === null or $value == ''
```

Fixes T15527

Test Plan:
Run
```
arc diff
```

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15527

Differential Revision: https://we.phorge.it/D25332
This commit is contained in:
Steve Campbell 2023-07-05 09:08:02 +01:00
parent d5a28e12a0
commit b3ac5ceb38

View file

@ -115,7 +115,7 @@ final class DifferentialGetCommitMessageConduitAPIMethod
$is_title = ($field_key == $key_title);
if (!strlen($value)) {
if ($value === null || $value === '') {
if ($is_template) {
$commit_message[] = $label.': ';
}