1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 14:51:06 +01:00

Fix PHP 8.1 "explode(null)" exception which blocks rendering the Multimeter page

Summary:
Passing null as an input string to explode() is deprecated in PHP 8.
Thus first check via `phutil_nonempty_string()` that the input string is not null.

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 T15361

Test Plan: Applied this change; afterwards `/multimeter/` correctly 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: T15361

Differential Revision: https://we.phorge.it/D25254
This commit is contained in:
Andre Klapper 2023-05-29 12:35:37 +02:00
parent 827f63a065
commit 0d81da5909

View file

@ -10,7 +10,7 @@ final class MultimeterSampleController extends MultimeterController {
$viewer = $this->getViewer();
$group_map = $this->getColumnMap();
$group = explode('.', $request->getStr('group'));
$group = explode('.', $request->getStr('group', ''));
$group = array_intersect($group, array_keys($group_map));
$group = array_fuse($group);