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
Unknown Object (File)
Wed, Apr 17, 06:16
Unknown Object (File)
Thu, Apr 11, 03:03
Unknown Object (File)
Sun, Apr 7, 05:44
Unknown Object (File)
Fri, Apr 5, 17:40
Unknown Object (File)
Mon, Apr 1, 01:40
Unknown Object (File)
Mon, Apr 1, 01:40
Unknown Object (File)
Mon, Apr 1, 01:40
Unknown Object (File)
Mon, Apr 1, 01:40

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