@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix PHP 8.1 "strlen(null)" exception when using Diffusion 'Compare'

Summary:
The method 'getSymbolicCommit()' can return null, and that value is not passed to strlen() anymore.

Closes T16297

Test Plan:
Visit the Diffusion page 'Compare' page without inputs, no warnings anymore from Dark console:

http://phorge.localhost/diffusion/1/compare/

Visit all the Diffusion page 'Compare' page of all your branches, they still work:

http://phorge.localhost/diffusion/1/branches/master/

(e.g. tested with branches 'master', 'devops', 'weblate', 'crashtest')

Compare two real branches like 'master' and 'test' or whatever, from this page, and it still works:

http://phorge.localhost/diffusion/1/compare/

Invert the branches. It still works.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T16297

Differential Revision: https://we.phorge.it/D26422

+3 -3
+3 -3
src/applications/diffusion/controller/DiffusionCompareController.php
··· 27 27 ->addCancelButton($this->getApplicationURI(), pht('Okay')); 28 28 } 29 29 30 - $head_ref = $request->getStr('head'); 31 - $against_ref = $request->getStr('against'); 30 + $head_ref = $request->getStr('head', ''); 31 + $against_ref = $request->getStr('against', ''); 32 32 33 33 $must_prompt = false; 34 34 if (!$request->isFormPost()) { 35 35 if (!strlen($head_ref)) { 36 36 $head_ref = $drequest->getSymbolicCommit(); 37 - if (!strlen($head_ref)) { 37 + if (!phutil_nonempty_string($head_ref)) { 38 38 $head_ref = $drequest->getBranch(); 39 39 } 40 40 }