Page MenuHomePhabricator

D21868.id52161.diff
No OneTemporary

D21868.id52161.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/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
Sun, Nov 10, 2:01 PM (3 d, 3 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6764196
Default Alt Text
D21868.id52161.diff (8 KB)

Event Timeline