diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php --- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php +++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php @@ -18,7 +18,7 @@ $invite = $this->loadInvite(); $is_setup = false; - if (strlen($account_key)) { + if (phutil_nonempty_string($account_key)) { $result = $this->loadAccountForRegistrationOrLinking($account_key); list($account, $provider, $response) = $result; $is_default = false; @@ -244,9 +244,9 @@ $require_real_name = PhabricatorEnv::getEnvConfig('user.require-real-name'); - $e_username = strlen($value_username) ? null : true; + $e_username = phutil_nonempty_string($value_username) ? null : true; $e_realname = $require_real_name ? true : null; - $e_email = strlen($value_email) ? null : true; + $e_email = phutil_nonempty_string($value_email) ? null : true; $e_password = true; $e_captcha = true; diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -74,7 +74,7 @@ $session_engine = new PhabricatorAuthSessionEngine(); $phsid = $request->getCookie(PhabricatorCookies::COOKIE_SESSION); - if (strlen($phsid)) { + if (phutil_nonempty_string($phsid)) { $session_user = $session_engine->loadUserForSession( PhabricatorAuthSession::TYPE_WEB, $phsid); diff --git a/src/view/form/control/AphrontFormControl.php b/src/view/form/control/AphrontFormControl.php --- a/src/view/form/control/AphrontFormControl.php +++ b/src/view/form/control/AphrontFormControl.php @@ -172,7 +172,7 @@ $this->renderInput()); $error = null; - if (strlen($this->getError())) { + if ($this->getError()) { $error = $this->getError(); if ($error === true) { $error = phutil_tag( @@ -187,7 +187,7 @@ } } - if (strlen($this->getLabel())) { + if (phutil_nonempty_string($this->getLabel())) { $label = phutil_tag( 'label', array( @@ -203,7 +203,7 @@ $custom_class .= ' aphront-form-control-nolabel'; } - if (strlen($this->getCaption())) { + if (phutil_nonempty_string($this->getCaption())) { $caption = phutil_tag( 'div', array('class' => 'aphront-form-caption'),