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
F3314038: D25224.1743225990.diff
Fri, Mar 28, 05:26
F3307385: D25224.1743144874.diff
Thu, Mar 27, 06:54
F3306395: D25224.1743127830.diff
Thu, Mar 27, 02:10
F3303567: D25224.1743083379.diff
Wed, Mar 26, 13:49
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

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