mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
Fix PHP 8.1 "strlen(null)" exception which blocks rendering the "Manage Menu" 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 replacement. However, the parameter `$item_id` is a numeric value when populated. Thus replace `strlen()` with `phutil_nonempty_scalar()` as `phutil_nonempty_string()` could break a Conduit API consumer sending a numeric value. Note: this may highlight other absurd input values that might be worth correcting instead of just ignoring. If phutil_nonempty_scalar() throws an exception in your instance, report it to Phorge to evaluate and fix that specific corner case. Closes T15317 Test Plan: Applied this change and `/home/menu/configure/` 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: T15317 Differential Revision: https://we.phorge.it/D25166
This commit is contained in:
parent
8f669ea082
commit
1d8483a9bd
1 changed files with 1 additions and 1 deletions
|
@ -135,7 +135,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
|
|||
if ($is_view) {
|
||||
$selected_item = $this->selectViewItem($view_list, $item_id);
|
||||
} else {
|
||||
if (!strlen($item_id)) {
|
||||
if (!phutil_nonempty_scalar($item_id)) {
|
||||
$item_id = self::ITEM_MANAGE;
|
||||
}
|
||||
$selected_item = $this->selectEditItem($view_list, $item_id);
|
||||
|
|
Loading…
Reference in a new issue