diff --git a/src/applications/herald/storage/transcript/HeraldTranscript.php b/src/applications/herald/storage/transcript/HeraldTranscript.php --- a/src/applications/herald/storage/transcript/HeraldTranscript.php +++ b/src/applications/herald/storage/transcript/HeraldTranscript.php @@ -66,6 +66,10 @@ } private static function combineXHeraldRulesHeaders($u, $v) { + if ($u === null) { + return $v; + } + $u = preg_split('/[, ]+/', $u); $v = preg_split('/[, ]+/', $v); diff --git a/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php b/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php --- a/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php +++ b/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php @@ -1435,7 +1435,7 @@ $task = ManiphestTask::initializeNewTask($viewer); - if (!strlen($name)) { + if ($name === null || $name === '') { $name = pht('Test Task'); } diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -407,11 +407,13 @@ $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); diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php --- a/src/applications/transactions/editengine/PhabricatorEditEngine.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php @@ -474,7 +474,9 @@ ->setIsDefault(true) ->setIsEdit(true); - if (!strlen($first->getName())) { + $first_name = $first->getName(); + + if ($first_name === null || $first_name === '') { $first->setName($this->getObjectCreateShortText()); } } else { diff --git a/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php b/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php --- a/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php +++ b/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php @@ -185,7 +185,7 @@ $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')