Page MenuHomePhorge

Fix PHP 8.1 "trim(null)" exception which blocks rendering Reports' Burnup Rate page
ClosedPublic

Authored by aklapper on May 12 2023, 22:08.
Tags
None
Referenced Files
F3292054: D25224.1742886698.diff
Mon, Mar 24, 07:11
F3224957: D25224.1742089879.diff
Sat, Mar 15, 01:51
F3223435: D25224.1741951152.diff
Thu, Mar 13, 11:19
F3221048: D25224.1741813513.diff
Tue, Mar 11, 21:05
F3221047: D25224.1741813509.diff
Tue, Mar 11, 21:05
F3221046: D25224.1741813506.diff
Tue, Mar 11, 21:05
F3220683: D25224.1741813021.diff
Tue, Mar 11, 20:57
F3215146: D25224.1741618701.diff
Sun, Mar 9, 14:58

Details

Summary

Since PHP 8.1, passing a null string to trim() is deprecated.

Thus first check that $row['oldValue'] is not null before trimming it.

Closes T15392

Test Plan

Applied this change; afterwards "Burnup Rate" page at /maniphest/report/burn/ got correctly rendered in web browser.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

src/applications/maniphest/controller/ManiphestReportController.php
192

Thanks but this is not so obvious for me to review since previously the trim(null, '"') was just returning an empty string and now it will return null. I will double-check.

Thanks

I tested this and it totally works. Also, since if this does not use any phutil_() stuff this will not cause any unexpected nuclear implosion.

Hoping to be useful I will just minimize this a bit even more

sgtm

This revision is now accepted and ready to land.May 21 2023, 08:15

minimize this even more, just because we can

src/applications/maniphest/controller/ManiphestReportController.php
202–203

Unrealated: for performance reasons we may like in the future to also add a strict check here to avoid the unuseful call to ManiphestTaskStatus::isOpenStatus(null) that returns false after comparing that in a loop with each possible known status

src/applications/maniphest/controller/ManiphestReportController.php
202–203

@aklapper If you want to relax proposing another easy-peasy patch, feel free to take inspiration from this small comment ↑

Easy +1