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.
Tags
None
Referenced Files
F2168694: D25254.diff
Sun, Apr 28, 20:13
Unknown Object (File)
Sat, Apr 27, 15:01
Unknown Object (File)
Sat, Apr 27, 13:35
Unknown Object (File)
Sat, Apr 27, 03:16
Unknown Object (File)
Sat, Apr 27, 01:53
Unknown Object (File)
Tue, Apr 16, 16:56
Unknown Object (File)
Thu, Apr 11, 20:04
Unknown Object (File)
Wed, Apr 10, 18:45

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
Branch
T15361multimeter (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 472
Build 472: arc lint + arc unit

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