@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 which block rendering the People page

Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as
a general replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

Use `phutil_nonempty_scalar()` instead in `PhabricatorSearchDateField.php` as
input could only be integer instead of string.

Closes T15297

Test Plan: Applied these four changes (on top of D25144, D25145, D25146) and `/people/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15297

Differential Revision: https://we.phorge.it/D25147

+13 -4
+1 -1
src/applications/files/controller/PhabricatorFileDataController.php
··· 29 29 $request_kind = $request->getURIData('kind'); 30 30 $is_download = ($request_kind === 'download'); 31 31 32 - if (!strlen($alt) || $main_domain == $alt_domain) { 32 + if (!phutil_nonempty_string($alt) || $main_domain == $alt_domain) { 33 33 // No alternate domain. 34 34 $should_redirect = false; 35 35 $is_alternate_domain = false;
+2 -2
src/applications/search/field/PhabricatorSearchDateField.php
··· 17 17 } 18 18 19 19 protected function validateControlValue($value) { 20 - if (!strlen($value)) { 20 + if (!phutil_nonempty_scalar($value)) { 21 21 return; 22 22 } 23 23 ··· 32 32 } 33 33 34 34 protected function parseDateTime($value) { 35 - if (!strlen($value)) { 35 + if (!phutil_nonempty_scalar($value)) { 36 36 return null; 37 37 } 38 38
+10 -1
src/view/layout/AphrontSideNavFilterView.php
··· 92 92 return $this->getMenuView()->getItem($key); 93 93 } 94 94 95 + /** 96 + * Add a thing in the menu 97 + * 98 + * @param string $key Internal name 99 + * @param string $name Human name 100 + * @param mixed $uri Destination URI. For example as string or as PhutilURI. 101 + * @param string $type Item type. For example see PHUIListItemView constants. 102 + * @param string $icon Icon name 103 + */ 95 104 private function addThing($key, $name, $uri, $type, $icon = null) { 96 105 $item = id(new PHUIListItemView()) 97 106 ->setName($name) 98 107 ->setType($type); 99 108 100 - if (strlen($icon)) { 109 + if (phutil_nonempty_string($icon)) { 101 110 $item->setIcon($icon); 102 111 } 103 112