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
F3317686: D25329.1743264513.diff
Fri, Mar 28, 16:08
F3309494: D25329.1743185118.diff
Thu, Mar 27, 18:05
F3306294: D25329.1743126667.diff
Thu, Mar 27, 01:51
F3298153: D25329.1742997877.diff
Tue, Mar 25, 14:04
F3295910: D25329.1742963930.diff
Tue, Mar 25, 04:38
F3294727: D25329.1742941798.diff
Mon, Mar 24, 22:29
F3289951: D25329.1742856371.diff
Sun, Mar 23, 22:46
F3283931: D25329.1742763069.diff
Sat, Mar 22, 20:51

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