Page MenuHomePhabricator

D21868.diff
No OneTemporary

D21868.diff

diff --git a/src/applications/almanac/controller/AlmanacPropertyEditController.php b/src/applications/almanac/controller/AlmanacPropertyEditController.php
--- a/src/applications/almanac/controller/AlmanacPropertyEditController.php
+++ b/src/applications/almanac/controller/AlmanacPropertyEditController.php
@@ -16,7 +16,7 @@
$cancel_uri = $object->getURI();
$property_key = $request->getStr('key');
- if (!strlen($property_key)) {
+ if (!phutil_nonempty_string($property_key)) {
return $this->buildPropertyKeyResponse($cancel_uri, null);
} else {
$error = null;
diff --git a/src/applications/auth/controller/mfa/PhabricatorAuthFactorProviderViewController.php b/src/applications/auth/controller/mfa/PhabricatorAuthFactorProviderViewController.php
--- a/src/applications/auth/controller/mfa/PhabricatorAuthFactorProviderViewController.php
+++ b/src/applications/auth/controller/mfa/PhabricatorAuthFactorProviderViewController.php
@@ -83,7 +83,7 @@
$custom_enroll = $provider->getEnrollMessage();
- if (strlen($custom_enroll)) {
+ if ($custom_enroll !== null && strlen($custom_enroll)) {
$view->addSectionHeader(
pht('Custom Enroll Message'),
PHUIPropertyListView::ICON_SUMMARY);
diff --git a/src/applications/auth/factor/PhabricatorAuthFactor.php b/src/applications/auth/factor/PhabricatorAuthFactor.php
--- a/src/applications/auth/factor/PhabricatorAuthFactor.php
+++ b/src/applications/auth/factor/PhabricatorAuthFactor.php
@@ -414,7 +414,7 @@
$sync_token = null;
$sync_key = $request->getStr($this->getMFASyncTokenFormKey());
- if (strlen($sync_key)) {
+ if (phutil_nonempty_string($sync_key)) {
$sync_key_digest = PhabricatorHash::digestWithNamedKey(
$sync_key,
PhabricatorAuthMFASyncTemporaryTokenType::DIGEST_KEY);
diff --git a/src/applications/auth/storage/PhabricatorAuthChallenge.php b/src/applications/auth/storage/PhabricatorAuthChallenge.php
--- a/src/applications/auth/storage/PhabricatorAuthChallenge.php
+++ b/src/applications/auth/storage/PhabricatorAuthChallenge.php
@@ -57,6 +57,9 @@
assert_instances_of($challenges, __CLASS__);
$token_list = $request->getStr(self::HTTPKEY);
+ if ($token_list === null) {
+ return;
+ }
$token_list = explode(' ', $token_list);
$token_map = array();
diff --git a/src/applications/conpherence/query/ConpherenceThreadQuery.php b/src/applications/conpherence/query/ConpherenceThreadQuery.php
--- a/src/applications/conpherence/query/ConpherenceThreadQuery.php
+++ b/src/applications/conpherence/query/ConpherenceThreadQuery.php
@@ -135,7 +135,8 @@
}
protected function buildGroupClause(AphrontDatabaseConnection $conn_r) {
- if ($this->participantPHIDs !== null || strlen($this->fulltext)) {
+ if ($this->participantPHIDs !== null
+ || ($this->fulltext !== null && strlen($this->fulltext))) {
return qsprintf($conn_r, 'GROUP BY thread.id');
} else {
return $this->buildApplicationSearchGroupClause($conn_r);
@@ -152,7 +153,7 @@
id(new ConpherenceParticipant())->getTableName());
}
- if (strlen($this->fulltext)) {
+ if ($this->fulltext !== null && strlen($this->fulltext)) {
$joins[] = qsprintf(
$conn,
'JOIN %T idx ON idx.threadPHID = thread.phid',
@@ -234,7 +235,7 @@
$this->participantPHIDs);
}
- if (strlen($this->fulltext)) {
+ if ($this->fulltext !== null && strlen($this->fulltext)) {
$where[] = qsprintf(
$conn,
'MATCH(idx.corpus) AGAINST (%s IN BOOLEAN MODE)',
diff --git a/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php b/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
--- a/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
+++ b/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
@@ -106,7 +106,7 @@
$engines = array();
$fulltext = $query->getParameter('fulltext');
- if (strlen($fulltext) && $conpherences) {
+ if ($fulltext !== null && strlen($fulltext) && $conpherences) {
$context = $this->loadContextMessages($conpherences, $fulltext);
$author_phids = array();
@@ -151,7 +151,7 @@
$icon = id(new PHUIIconView())
->setIcon($icon_name);
- if (!strlen($fulltext)) {
+ if ($fulltext === null || !strlen($fulltext)) {
$item = id(new PHUIObjectItemView())
->setObjectName($conpherence->getMonogram())
->setHeader($title)
diff --git a/src/applications/diviner/query/DivinerBookQuery.php b/src/applications/diviner/query/DivinerBookQuery.php
--- a/src/applications/diviner/query/DivinerBookQuery.php
+++ b/src/applications/diviner/query/DivinerBookQuery.php
@@ -133,7 +133,7 @@
$this->phids);
}
- if (strlen($this->nameLike)) {
+ if ($this->nameLike !== null && strlen($this->nameLike)) {
$where[] = qsprintf(
$conn,
'name LIKE %~',
@@ -147,7 +147,7 @@
$this->names);
}
- if (strlen($this->namePrefix)) {
+ if ($this->namePrefix !== null && strlen($this->namePrefix)) {
$where[] = qsprintf(
$conn,
'name LIKE %>',
diff --git a/src/applications/metamta/engine/PhabricatorMailEmailEngine.php b/src/applications/metamta/engine/PhabricatorMailEmailEngine.php
--- a/src/applications/metamta/engine/PhabricatorMailEmailEngine.php
+++ b/src/applications/metamta/engine/PhabricatorMailEmailEngine.php
@@ -91,7 +91,7 @@
$parts = array();
$encrypt_uri = $mail->getMustEncryptURI();
- if (!strlen($encrypt_uri)) {
+ if ($encrypt_uri === null || !strlen($encrypt_uri)) {
$encrypt_phid = $mail->getRelatedPHID();
if ($encrypt_phid) {
$encrypt_uri = urisprintf(
@@ -100,7 +100,7 @@
}
}
- if (strlen($encrypt_uri)) {
+ if ($encrypt_uri !== null && strlen($encrypt_uri)) {
$parts[] = pht(
'This secure message is notifying you of a change to this object:');
$parts[] = PhabricatorEnv::getProductionURI($encrypt_uri);
@@ -242,7 +242,8 @@
}
// If we don't have a display name, fill in a default.
- if (!strlen($reply_address->getDisplayName())) {
+ $reply_display_name = $reply_address->getDisplayName();
+ if ($reply_display_name === null || !strlen($reply_display_name)) {
$reply_address->setDisplayName(PlatformSymbols::getPlatformServerName());
}
@@ -313,7 +314,7 @@
// a generic one.
if ($must_encrypt) {
$encrypt_subject = $mail->getMustEncryptSubject();
- if (!strlen($encrypt_subject)) {
+ if ($encrypt_subject === null || !strlen($encrypt_subject)) {
$encrypt_subject = pht('Object Updated');
}
$subject[] = $encrypt_subject;
@@ -497,7 +498,7 @@
$object = id(new PhutilEmailAddress())
->setAddress($address);
- if (strlen($name)) {
+ if ($name !== null && strlen($name)) {
$object->setDisplayName($name);
}
@@ -507,7 +508,7 @@
public function newDefaultEmailAddress() {
$raw_address = PhabricatorEnv::getEnvConfig('metamta.default-address');
- if (!strlen($raw_address)) {
+ if ($raw_address == null || !strlen($raw_address)) {
$domain = $this->newMailDomain();
$raw_address = "noreply@{$domain}";
}
@@ -527,7 +528,7 @@
private function newMailDomain() {
$domain = PhabricatorEnv::getEnvConfig('metamta.reply-handler-domain');
- if (strlen($domain)) {
+ if ($domain !== null && strlen($domain)) {
return $domain;
}
diff --git a/src/applications/metamta/exception/PhabricatorMetaMTAReceivedMailProcessingException.php b/src/applications/metamta/exception/PhabricatorMetaMTAReceivedMailProcessingException.php
--- a/src/applications/metamta/exception/PhabricatorMetaMTAReceivedMailProcessingException.php
+++ b/src/applications/metamta/exception/PhabricatorMetaMTAReceivedMailProcessingException.php
@@ -14,7 +14,7 @@
$this->statusCode = $args[0];
$args = array_slice($args, 1);
- call_user_func_array(array('parent', '__construct'), $args);
+ call_user_func_array(array(parent::class, '__construct'), $args);
}
}
diff --git a/src/applications/passphrase/view/PassphraseCredentialControl.php b/src/applications/passphrase/view/PassphraseCredentialControl.php
--- a/src/applications/passphrase/view/PassphraseCredentialControl.php
+++ b/src/applications/passphrase/view/PassphraseCredentialControl.php
@@ -50,7 +50,9 @@
// credential. Populate it into the menu to allow them to save the form
// without making any changes.
$current_phid = $this->getValue();
- if (strlen($current_phid) && empty($options_map[$current_phid])) {
+ if ($current_phid !== null && strlen($current_phid)
+ && empty($options_map[$current_phid])) {
+
$viewer = $this->getViewer();
$current_name = null;
diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php
--- a/src/applications/phame/storage/PhameBlog.php
+++ b/src/applications/phame/storage/PhameBlog.php
@@ -169,7 +169,7 @@
}
public function getLiveURI() {
- if (strlen($this->getDomain())) {
+ if ($this->getDomain() !== null && strlen($this->getDomain())) {
return $this->getExternalLiveURI();
} else {
return $this->getInternalLiveURI();
diff --git a/src/applications/pholio/controller/PholioImageUploadController.php b/src/applications/pholio/controller/PholioImageUploadController.php
--- a/src/applications/pholio/controller/PholioImageUploadController.php
+++ b/src/applications/pholio/controller/PholioImageUploadController.php
@@ -18,7 +18,7 @@
return new Aphront404Response();
}
- if (!strlen($title)) {
+ if (!phutil_nonempty_string($title)) {
$title = $file->getName();
}
diff --git a/src/applications/spaces/xaction/PhabricatorSpacesNamespaceNameTransaction.php b/src/applications/spaces/xaction/PhabricatorSpacesNamespaceNameTransaction.php
--- a/src/applications/spaces/xaction/PhabricatorSpacesNamespaceNameTransaction.php
+++ b/src/applications/spaces/xaction/PhabricatorSpacesNamespaceNameTransaction.php
@@ -15,7 +15,7 @@
public function getTitle() {
$old = $this->getOldValue();
- if (!strlen($old)) {
+ if ($old === null || !strlen($old)) {
return pht(
'%s created this space.',
$this->renderAuthor());
diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php
--- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php
+++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php
@@ -339,7 +339,7 @@
$value = $xaction->getNewValue();
}
- return !strlen($value);
+ return $value === null || !strlen($value);
}
/**
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
@@ -40,7 +40,7 @@
// TODO: Clean this up.
$result = array();
- if (!is_array($value)) {
+ if ($value !== null && !is_array($value)) {
$value = json_decode($value, true);
if (is_array($value)) {
$result = array_values($value);

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 29, 7:30 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6753509
Default Alt Text
D21868.diff (11 KB)

Event Timeline