mirror of
https://we.phorge.it/source/phorge.git
synced 2025-04-11 03:48:34 +02: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:
parent
c25595417f
commit
a9822a37aa
5 changed files with 13 additions and 5 deletions
|
@ -66,6 +66,10 @@ final class HeraldTranscript extends HeraldDAO
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function combineXHeraldRulesHeaders($u, $v) {
|
private static function combineXHeraldRulesHeaders($u, $v) {
|
||||||
|
if ($u === null) {
|
||||||
|
return $v;
|
||||||
|
}
|
||||||
|
|
||||||
$u = preg_split('/[, ]+/', $u);
|
$u = preg_split('/[, ]+/', $u);
|
||||||
$v = preg_split('/[, ]+/', $v);
|
$v = preg_split('/[, ]+/', $v);
|
||||||
|
|
||||||
|
|
|
@ -1435,7 +1435,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase {
|
||||||
|
|
||||||
$task = ManiphestTask::initializeNewTask($viewer);
|
$task = ManiphestTask::initializeNewTask($viewer);
|
||||||
|
|
||||||
if (!strlen($name)) {
|
if ($name === null || $name === '') {
|
||||||
$name = pht('Test Task');
|
$name = pht('Test Task');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -407,11 +407,13 @@ final class PhabricatorProject extends PhabricatorProjectDAO
|
||||||
$this->setMailKey(Filesystem::readRandomCharacters(20));
|
$this->setMailKey(Filesystem::readRandomCharacters(20));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strlen($this->getPHID())) {
|
$phid = $this->getPHID();
|
||||||
|
if ($phid === null || $phid === '') {
|
||||||
$this->setPHID($this->generatePHID());
|
$this->setPHID($this->generatePHID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strlen($this->getProjectPathKey())) {
|
$path_key = $this->getProjectPathKey();
|
||||||
|
if ($path_key === null || $path_key === '') {
|
||||||
$hash = PhabricatorHash::digestForIndex($this->getPHID());
|
$hash = PhabricatorHash::digestForIndex($this->getPHID());
|
||||||
$hash = substr($hash, 0, 4);
|
$hash = substr($hash, 0, 4);
|
||||||
$this->setProjectPathKey($hash);
|
$this->setProjectPathKey($hash);
|
||||||
|
|
|
@ -474,7 +474,9 @@ abstract class PhabricatorEditEngine
|
||||||
->setIsDefault(true)
|
->setIsDefault(true)
|
||||||
->setIsEdit(true);
|
->setIsEdit(true);
|
||||||
|
|
||||||
if (!strlen($first->getName())) {
|
$first_name = $first->getName();
|
||||||
|
|
||||||
|
if ($first_name === null || $first_name === '') {
|
||||||
$first->setName($this->getObjectCreateShortText());
|
$first->setName($this->getObjectCreateShortText());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -185,7 +185,7 @@ final class PhabricatorEditEngineConfiguration
|
||||||
$fields = $this->reorderFields($fields);
|
$fields = $this->reorderFields($fields);
|
||||||
|
|
||||||
$preamble = $this->getPreamble();
|
$preamble = $this->getPreamble();
|
||||||
if (strlen($preamble)) {
|
if ($preamble !== null && strlen($preamble)) {
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'config.preamble' => id(new PhabricatorInstructionsEditField())
|
'config.preamble' => id(new PhabricatorInstructionsEditField())
|
||||||
->setKey('config.preamble')
|
->setKey('config.preamble')
|
||||||
|
|
Loading…
Add table
Reference in a new issue