diff --git a/src/aphront/site/AphrontSite.php b/src/aphront/site/AphrontSite.php index 85bf42fe6c..08813462c6 100644 --- a/src/aphront/site/AphrontSite.php +++ b/src/aphront/site/AphrontSite.php @@ -15,7 +15,7 @@ public function new404Controller(AphrontRequest $request) { protected function isHostMatch($host, array $uris) { foreach ($uris as $uri) { - if (!strlen($uri)) { + if (!phutil_nonempty_string($uri)) { continue; } diff --git a/src/aphront/site/PhabricatorResourceSite.php b/src/aphront/site/PhabricatorResourceSite.php index 88f7777607..3fca474a17 100644 --- a/src/aphront/site/PhabricatorResourceSite.php +++ b/src/aphront/site/PhabricatorResourceSite.php @@ -14,7 +14,7 @@ public function newSiteForRequest(AphrontRequest $request) { $host = $request->getHost(); $uri = PhabricatorEnv::getEnvConfig('security.alternate-file-domain'); - if (!strlen($uri)) { + if (!phutil_nonempty_string($uri)) { return null; } diff --git a/src/applications/auth/adapter/PhutilLDAPAuthAdapter.php b/src/applications/auth/adapter/PhutilLDAPAuthAdapter.php index 14047c1761..5fad88ed76 100644 --- a/src/applications/auth/adapter/PhutilLDAPAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilLDAPAuthAdapter.php @@ -475,7 +475,7 @@ private function bindLDAP($conn, $user, PhutilOpaqueEnvelope $pass) { $profiler->endServiceCall($call_id, array()); if (!$ok) { - if (strlen($user)) { + if (phutil_nonempty_string($user)) { $this->raiseConnectionException( $conn, pht('Failed to bind to LDAP server (as user "%s").', $user)); diff --git a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php index d1db832aa2..6998ae9240 100644 --- a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php @@ -142,7 +142,7 @@ public function processLoginRequest( $username = $request->getStr('ldap_username'); $password = $request->getStr('ldap_password'); - $has_password = strlen($password); + $has_password = phutil_nonempty_string($password); $password = new PhutilOpaqueEnvelope($password); if (!strlen($username) || !$has_password) { diff --git a/src/applications/auth/view/PhabricatorAuthAccountView.php b/src/applications/auth/view/PhabricatorAuthAccountView.php index 9746be7841..65ed586838 100644 --- a/src/applications/auth/view/PhabricatorAuthAccountView.php +++ b/src/applications/auth/view/PhabricatorAuthAccountView.php @@ -29,13 +29,13 @@ public function render() { $realname = $account->getRealName(); $use_name = null; - if (strlen($dispname)) { + if (phutil_nonempty_string($dispname)) { $use_name = $dispname; - } else if (strlen($username) && strlen($realname)) { + } else if (phutil_nonempty_string($username) && phutil_nonempty_string($realname)) { $use_name = $username.' ('.$realname.')'; - } else if (strlen($username)) { + } else if (phutil_nonempty_string($username)) { $use_name = $username; - } else if (strlen($realname)) { + } else if (phutil_nonempty_string($realname)) { $use_name = $realname; } @@ -62,7 +62,7 @@ public function render() { )); $account_uri = $account->getAccountURI(); - if (strlen($account_uri)) { + if (phutil_nonempty_string($account_uri)) { // Make sure we don't link a "javascript:" URI if a user somehow // managed to get one here. diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php index 870cb46000..9e62a58e51 100644 --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -153,7 +153,7 @@ private function buildCrumbList(array $spec = array()) { if (!$spec['commit'] && !$spec['tags'] && !$spec['branches']) { $branch_name = $drequest->getBranch(); - if (strlen($branch_name)) { + if (phutil_nonempty_string($branch_name)) { $repository_name .= ' ('.$branch_name.')'; } } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php index ad3518b81e..86686162d0 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -362,7 +362,7 @@ private function buildDescriptionView(PhabricatorRepository $repository) { ->setUser($viewer); $description = $repository->getDetail('description'); - if (strlen($description)) { + if (phutil_nonempty_string($description)) { $description = new PHUIRemarkupView($viewer, $description); $view->addTextContent($description); return id(new PHUIObjectBoxView()) @@ -508,7 +508,7 @@ private function buildBrowseTable( $repository_name = $repository->getName(); $branch_name = $drequest->getBranch(); - if (strlen($branch_name)) { + if (phutil_nonempty_string($branch_name)) { $repository_name .= ' ('.$branch_name.')'; } diff --git a/src/applications/diffusion/controller/DiffusionServeController.php b/src/applications/diffusion/controller/DiffusionServeController.php index f693b7d14e..f0d9c28955 100644 --- a/src/applications/diffusion/controller/DiffusionServeController.php +++ b/src/applications/diffusion/controller/DiffusionServeController.php @@ -64,7 +64,7 @@ public function isVCSRequest(AphrontRequest $request) { } else if ($content_type == 'application/x-git-receive-pack-request') { // We get this for `git-receive-pack`. $vcs = PhabricatorRepositoryType::REPOSITORY_TYPE_GIT; - } else if (preg_match($lfs_pattern, $content_type)) { + } else if (preg_match($lfs_pattern,phutil_nonempty_string( $content_type))) { // This is a Git LFS HTTP API request. $vcs = PhabricatorRepositoryType::REPOSITORY_TYPE_GIT; $this->isGitLFSRequest = true; diff --git a/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php b/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php index e0662b1e1a..cc9da44723 100644 --- a/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php +++ b/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php @@ -41,7 +41,7 @@ public function loadResults() { $parts[] = $name; $slug = $repository->getRepositorySlug(); - if (strlen($slug)) { + if (phutil_nonempty_string($slug)) { $parts[] = $slug; } diff --git a/src/applications/phriction/markup/PhrictionRemarkupRule.php b/src/applications/phriction/markup/PhrictionRemarkupRule.php index 8394b23218..4a1142adc5 100644 --- a/src/applications/phriction/markup/PhrictionRemarkupRule.php +++ b/src/applications/phriction/markup/PhrictionRemarkupRule.php @@ -191,7 +191,7 @@ public function didMarkupText() { // If the name is something meaningful to humans, we'll render this // in text as: "Title" . Otherwise, we'll just render: . - $is_interesting_name = (bool)strlen($name); + $is_interesting_name = (bool)phutil_nonempty_string($name); $target = idx($document_map, $key, null); diff --git a/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php b/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php index 9247966d75..4a9cfbb8a6 100644 --- a/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php +++ b/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php @@ -43,7 +43,7 @@ public function loadHandles( $handle->setName($name); - if (strlen($slug)) { + if (phutil_nonempty_string($slug)) { $handle->setObjectName('#'.$slug); $handle->setMailStampName('#'.$slug); $handle->setURI("/tag/{$slug}/"); diff --git a/src/applications/project/typeahead/PhabricatorProjectDatasource.php b/src/applications/project/typeahead/PhabricatorProjectDatasource.php index 5be7ace110..176ccb12c7 100644 --- a/src/applications/project/typeahead/PhabricatorProjectDatasource.php +++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php @@ -84,7 +84,7 @@ public function loadResults() { } $slug = $proj->getPrimarySlug(); - if (!strlen($slug)) { + if (!phutil_nonempty_string($slug)) { foreach ($proj->getSlugs() as $slug_object) { $slug = $slug_object->getSlug(); if (strlen($slug)) { @@ -133,7 +133,7 @@ public function loadResults() { ->setPriorityType('proj') ->setClosed($closed); - if (strlen($slug)) { + if (phutil_nonempty_string($slug)) { $proj_result->setAutocomplete('#'.$slug); } diff --git a/src/applications/search/engineextension/PhabricatorFerretSearchEngineExtension.php b/src/applications/search/engineextension/PhabricatorFerretSearchEngineExtension.php index 55b7c2225a..08f3048e69 100644 --- a/src/applications/search/engineextension/PhabricatorFerretSearchEngineExtension.php +++ b/src/applications/search/engineextension/PhabricatorFerretSearchEngineExtension.php @@ -27,7 +27,7 @@ public function applyConstraintsToQuery( PhabricatorSavedQuery $saved, array $map) { - if (!strlen($map['query'])) { + if (!phutil_nonempty_string($map['query'])) { return; } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php index 4c0bce861b..af1405e4b6 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php @@ -301,7 +301,7 @@ public function shouldAppearInPropertyView() { } public function renderPropertyViewValue(array $handles) { - if (!strlen($this->getFieldValue())) { + if (!phutil_nonempty_string($this->getFieldValue())) { return null; } return $this->getFieldValue();