@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+7 -7
+3 -3
src/applications/auth/controller/PhabricatorAuthRegisterController.php
··· 18 18 $invite = $this->loadInvite(); 19 19 20 20 $is_setup = false; 21 - if (strlen($account_key)) { 21 + if (phutil_nonempty_string($account_key)) { 22 22 $result = $this->loadAccountForRegistrationOrLinking($account_key); 23 23 list($account, $provider, $response) = $result; 24 24 $is_default = false; ··· 244 244 245 245 $require_real_name = PhabricatorEnv::getEnvConfig('user.require-real-name'); 246 246 247 - $e_username = strlen($value_username) ? null : true; 247 + $e_username = phutil_nonempty_string($value_username) ? null : true; 248 248 $e_realname = $require_real_name ? true : null; 249 - $e_email = strlen($value_email) ? null : true; 249 + $e_email = phutil_nonempty_string($value_email) ? null : true; 250 250 $e_password = true; 251 251 $e_captcha = true; 252 252
+1 -1
src/applications/base/controller/PhabricatorController.php
··· 74 74 $session_engine = new PhabricatorAuthSessionEngine(); 75 75 76 76 $phsid = $request->getCookie(PhabricatorCookies::COOKIE_SESSION); 77 - if (strlen($phsid)) { 77 + if (phutil_nonempty_string($phsid)) { 78 78 $session_user = $session_engine->loadUserForSession( 79 79 PhabricatorAuthSession::TYPE_WEB, 80 80 $phsid);
+3 -3
src/view/form/control/AphrontFormControl.php
··· 172 172 $this->renderInput()); 173 173 174 174 $error = null; 175 - if (strlen($this->getError())) { 175 + if ($this->getError()) { 176 176 $error = $this->getError(); 177 177 if ($error === true) { 178 178 $error = phutil_tag( ··· 187 187 } 188 188 } 189 189 190 - if (strlen($this->getLabel())) { 190 + if (phutil_nonempty_string($this->getLabel())) { 191 191 $label = phutil_tag( 192 192 'label', 193 193 array( ··· 203 203 $custom_class .= ' aphront-form-control-nolabel'; 204 204 } 205 205 206 - if (strlen($this->getCaption())) { 206 + if (phutil_nonempty_string($this->getCaption())) { 207 207 $caption = phutil_tag( 208 208 'div', 209 209 array('class' => 'aphront-form-caption'),