Page MenuHomePhorge

Fix passing null to trim() error in DiffusionBrowseTableView render()
ClosedPublic

Authored by Sten on Jul 4 2023, 15:13.
Tags
None
Referenced Files
F2227288: D25329.1718358878.diff
Thu, Jun 13, 09:54
F2227243: D25329.1718347291.diff
Thu, Jun 13, 06:41
F2227210: D25329.1718336970.diff
Thu, Jun 13, 03:49
F2227179: D25329.1718333460.diff
Thu, Jun 13, 02:51
F2226989: D25329.1718308473.diff
Wed, Jun 12, 19:54
F2226744: D25329.1718296181.diff
Wed, Jun 12, 16:29
Unknown Object (File)
Wed, Jun 12, 11:36
Unknown Object (File)
Wed, Jun 12, 09:32

Details

Summary

When viewing the top level of a diffusion repository, $request->getPath() returns null, which then causes trim() to throw an error.

Fix is to update DiffusionRequest getPath() such that it returns '' instead of null, thus fixing it's return type.

Fixes T15522

Test Plan

Diff Detail

Repository
rP Phorge
Branch
DiffusionBrowseTableView (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 648
Build 648: arc lint + arc unit

Event Timeline

Sten requested review of this revision.Jul 4 2023, 15:13

Remove earlier changes to DiffusionBrowseTableView

src/applications/diffusion/request/DiffusionRequest.php
12

Note that, if we are sure that the default should never be NULL, we can just assume this default ↑

But take this tip with small tweezers.

src/applications/diffusion/request/DiffusionRequest.php
12

Great minds think alike - this was the first thing I tried, and we still got the error.
Seems that $path is being set to null elsewhere.

src/applications/diffusion/request/DiffusionRequest.php
12

.__.

257

Maybe you can like this function: coalesce()

Example use:

return coalesce($this->path, '');

Soft +1 but we need some other opinions here

coalesce - I like that. It's going to see some use!

Sten marked an inline comment as done.Jul 5 2023, 15:45
This revision is now accepted and ready to land.Jul 17 2023, 06:02