1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Fix a PHP 8.1 unit test failure in Projects

Summary: Ref T13588. This field may be "null" (and is probably never the empty string, but that's a more ambitious fix).

Test Plan: Ran unit tests, got a pass.

Maniphest Tasks: T13588

Differential Revision: https://secure.phabricator.com/D21752
This commit is contained in:
epriestley 2022-04-01 12:06:38 -07:00
parent c25595417f
commit a9822a37aa
5 changed files with 13 additions and 5 deletions

View file

@ -66,6 +66,10 @@ final class HeraldTranscript extends HeraldDAO
}
private static function combineXHeraldRulesHeaders($u, $v) {
if ($u === null) {
return $v;
}
$u = preg_split('/[, ]+/', $u);
$v = preg_split('/[, ]+/', $v);

View file

@ -1435,7 +1435,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase {
$task = ManiphestTask::initializeNewTask($viewer);
if (!strlen($name)) {
if ($name === null || $name === '') {
$name = pht('Test Task');
}

View file

@ -407,11 +407,13 @@ final class PhabricatorProject extends PhabricatorProjectDAO
$this->setMailKey(Filesystem::readRandomCharacters(20));
}
if (!strlen($this->getPHID())) {
$phid = $this->getPHID();
if ($phid === null || $phid === '') {
$this->setPHID($this->generatePHID());
}
if (!strlen($this->getProjectPathKey())) {
$path_key = $this->getProjectPathKey();
if ($path_key === null || $path_key === '') {
$hash = PhabricatorHash::digestForIndex($this->getPHID());
$hash = substr($hash, 0, 4);
$this->setProjectPathKey($hash);

View file

@ -474,7 +474,9 @@ abstract class PhabricatorEditEngine
->setIsDefault(true)
->setIsEdit(true);
if (!strlen($first->getName())) {
$first_name = $first->getName();
if ($first_name === null || $first_name === '') {
$first->setName($this->getObjectCreateShortText());
}
} else {

View file

@ -185,7 +185,7 @@ final class PhabricatorEditEngineConfiguration
$fields = $this->reorderFields($fields);
$preamble = $this->getPreamble();
if (strlen($preamble)) {
if ($preamble !== null && strlen($preamble)) {
$fields = array(
'config.preamble' => id(new PhabricatorInstructionsEditField())
->setKey('config.preamble')