Page MenuHomePhorge

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

Authored by aklapper on May 28 2023, 13:48.

Details

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.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

src/applications/multimeter/controller/MultimeterSampleController.php
13

Maybe the minimal and safer approach is to use the getStr($something, $default) with $default expressed

Indeed, getStr() can do that, right...

Aaaaaand... thaaanks again!

Tested locally, no nuclear implosions, it seems the very minimal safer change to me, without using phutil stuff

sgtm

This revision is now accepted and ready to land.May 29 2023, 09:27