mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Fix PHP 8.1 "strlen(null)" exception rendering PHUISegmentBar without a label
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. 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. ``` EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261] arcanist(head=master, ref.master=df6c315ace5f), phorge(head=master, ref.master=3cc5ee6a33df) #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/view/phui/PHUISegmentBarView.php:33] ``` Closes T15622 Test Plan: After applying this change, page with the PHUISegmentBar without label renders as expected without an exception. For example, visit this page: /uiexample/view/PhabricatorAphrontBarUIExample/ Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15622 Differential Revision: https://we.phorge.it/D25414
This commit is contained in:
parent
005fea5a14
commit
5d80b3fd88
1 changed files with 1 additions and 1 deletions
|
@ -30,7 +30,7 @@ final class PHUISegmentBarView extends AphrontTagView {
|
|||
require_celerity_resource('phui-segment-bar-view-css');
|
||||
|
||||
$label = $this->label;
|
||||
if (strlen($label)) {
|
||||
if ($label !== null) {
|
||||
$label = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
|
|
Loading…
Reference in a new issue