1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-16 16:58:38 +01:00

Fix numerous PHP 8.1 "strlen(null)" exceptions trying access Configuration 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 your phutil_nonempty_string() throws an exception, just
report it to Phorge to evaluate and fix together that specific corner case.

Closes T15287

Test Plan: Applied these three changes and `/config/` 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: T15287

Differential Revision: https://we.phorge.it/D25141
This commit is contained in:
Andre Klapper 2023-04-29 14:39:08 +02:00
parent 74dfe6f971
commit c37412df45
2 changed files with 3 additions and 3 deletions

View file

@ -85,14 +85,14 @@ final class PhabricatorConfigConsoleController
$rows = array();
foreach ($versions as $name => $info) {
$branchpoint = $info['branchpoint'];
if (strlen($branchpoint)) {
if (phutil_nonempty_string($branchpoint)) {
$branchpoint = substr($branchpoint, 0, 12);
} else {
$branchpoint = null;
}
$version = $info['hash'];
if (strlen($version)) {
if (phutil_nonempty_string($version)) {
$version = substr($version, 0, 12);
} else {
$version = pht('Unknown');

View file

@ -135,7 +135,7 @@ final class AphrontTableView extends AphrontView {
$col_classes = array();
foreach ($this->columnClasses as $key => $class) {
if (strlen($class)) {
if (phutil_nonempty_string($class)) {
$col_classes[] = $class;
} else {
$col_classes[] = null;