mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Fix PHP 8.1 "strlen(null)" exceptions to render the Account Creation page
Summary: Fix numerous PHP 8.1 "strlen(null)" exceptions which block rendering the initial Account Creation page in a fresh Phorge installation. The strlen() was used in Phabricator to check if a generic value was a non-empty string. For this reason, Phorge adopts phutil_nonempty_string() that checks that. Note: this may highlight other absurd input values that might be worth correcting instead of just ignoring. If your phutil_nonempty_string() throws an exception, just report it to Phorge to evaluate and fix together that specific corner case. Closes T15279 Test Plan: After these code changes the account creation page got displayed (though without CSS and JS). Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: avivey, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15279 Differential Revision: https://we.phorge.it/D25137
This commit is contained in:
parent
ac99285c57
commit
562d36ef5f
3 changed files with 7 additions and 7 deletions
|
@ -18,7 +18,7 @@ final class PhabricatorAuthRegisterController
|
||||||
$invite = $this->loadInvite();
|
$invite = $this->loadInvite();
|
||||||
|
|
||||||
$is_setup = false;
|
$is_setup = false;
|
||||||
if (strlen($account_key)) {
|
if (phutil_nonempty_string($account_key)) {
|
||||||
$result = $this->loadAccountForRegistrationOrLinking($account_key);
|
$result = $this->loadAccountForRegistrationOrLinking($account_key);
|
||||||
list($account, $provider, $response) = $result;
|
list($account, $provider, $response) = $result;
|
||||||
$is_default = false;
|
$is_default = false;
|
||||||
|
@ -244,9 +244,9 @@ final class PhabricatorAuthRegisterController
|
||||||
|
|
||||||
$require_real_name = PhabricatorEnv::getEnvConfig('user.require-real-name');
|
$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_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_password = true;
|
||||||
$e_captcha = true;
|
$e_captcha = true;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ abstract class PhabricatorController extends AphrontController {
|
||||||
$session_engine = new PhabricatorAuthSessionEngine();
|
$session_engine = new PhabricatorAuthSessionEngine();
|
||||||
|
|
||||||
$phsid = $request->getCookie(PhabricatorCookies::COOKIE_SESSION);
|
$phsid = $request->getCookie(PhabricatorCookies::COOKIE_SESSION);
|
||||||
if (strlen($phsid)) {
|
if (phutil_nonempty_string($phsid)) {
|
||||||
$session_user = $session_engine->loadUserForSession(
|
$session_user = $session_engine->loadUserForSession(
|
||||||
PhabricatorAuthSession::TYPE_WEB,
|
PhabricatorAuthSession::TYPE_WEB,
|
||||||
$phsid);
|
$phsid);
|
||||||
|
|
|
@ -172,7 +172,7 @@ abstract class AphrontFormControl extends AphrontView {
|
||||||
$this->renderInput());
|
$this->renderInput());
|
||||||
|
|
||||||
$error = null;
|
$error = null;
|
||||||
if (strlen($this->getError())) {
|
if ($this->getError()) {
|
||||||
$error = $this->getError();
|
$error = $this->getError();
|
||||||
if ($error === true) {
|
if ($error === true) {
|
||||||
$error = phutil_tag(
|
$error = phutil_tag(
|
||||||
|
@ -187,7 +187,7 @@ abstract class AphrontFormControl extends AphrontView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->getLabel())) {
|
if (phutil_nonempty_string($this->getLabel())) {
|
||||||
$label = phutil_tag(
|
$label = phutil_tag(
|
||||||
'label',
|
'label',
|
||||||
array(
|
array(
|
||||||
|
@ -203,7 +203,7 @@ abstract class AphrontFormControl extends AphrontView {
|
||||||
$custom_class .= ' aphront-form-control-nolabel';
|
$custom_class .= ' aphront-form-control-nolabel';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->getCaption())) {
|
if (phutil_nonempty_string($this->getCaption())) {
|
||||||
$caption = phutil_tag(
|
$caption = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array('class' => 'aphront-form-caption'),
|
array('class' => 'aphront-form-caption'),
|
||||||
|
|
Loading…
Reference in a new issue