mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Fix PHP 8.1 "strlen(null)" exceptions which block rendering the Dashboard 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. 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. Closes T15295 Test Plan: Applied these four changes (on top of D25144 and D25145) and `/dashboard/` 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: T15295 Differential Revision: https://we.phorge.it/D25146
This commit is contained in:
parent
f8ae17bb6a
commit
bccd4f5981
4 changed files with 10 additions and 4 deletions
|
@ -775,7 +775,7 @@ final class PhabricatorApplicationSearchController
|
|||
$force_nux) {
|
||||
|
||||
// Don't render NUX if the user has clicked away from the default page.
|
||||
if (strlen($this->getQueryKey())) {
|
||||
if (phutil_nonempty_string($this->getQueryKey())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ abstract class PhabricatorApplicationSearchEngine extends Phobject {
|
|||
|
||||
$order = $saved->getParameter('order');
|
||||
$builtin = $query->getBuiltinOrderAliasMap();
|
||||
if (strlen($order) && isset($builtin[$order])) {
|
||||
if (phutil_nonempty_string($order) && isset($builtin[$order])) {
|
||||
$query->setOrder($order);
|
||||
} else {
|
||||
// If the order is invalid or not available, we choose the first
|
||||
|
|
|
@ -68,7 +68,7 @@ final class AphrontFormTokenizerControl extends AphrontFormControl {
|
|||
$datasource->setViewer($this->getUser());
|
||||
|
||||
$placeholder = null;
|
||||
if (!strlen($this->placeholder)) {
|
||||
if (!phutil_nonempty_string($this->placeholder)) {
|
||||
$placeholder = $datasource->getPlaceholderText();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,12 @@ final class PHUIInfoView extends AphrontTagView {
|
|||
private $flush;
|
||||
private $icon;
|
||||
|
||||
/**
|
||||
* Set a title
|
||||
*
|
||||
* @param string|null $title
|
||||
* @return self
|
||||
*/
|
||||
public function setTitle($title) {
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
|
@ -147,7 +153,7 @@ final class PHUIInfoView extends AphrontTagView {
|
|||
}
|
||||
|
||||
$title = $this->title;
|
||||
if ($title || strlen($title)) {
|
||||
if ($title || phutil_nonempty_string($title)) {
|
||||
$title = phutil_tag(
|
||||
'h1',
|
||||
array(
|
||||
|
|
Loading…
Reference in a new issue