1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Fix PHP 8.1 Diffusion history errors

Summary:
Fix multiple PHP 8.1 errors when viewing Diffusion history.

Fixes T15573

Test Plan: View a diffusion history page. Eg https://my.php81.phorge.site/source/myrepo/history/master/

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15573

Differential Revision: https://we.phorge.it/D25366
This commit is contained in:
sten 2023-07-29 12:51:00 +01:00
parent fa687b4ba0
commit 1802ebd2cc
2 changed files with 7 additions and 5 deletions

View file

@ -50,7 +50,7 @@ final class DiffusionHistoryController extends DiffusionController {
// ancestors appropriately, but this would currrently be prohibitively
// expensive in the general case.
$show_graph = !strlen($drequest->getPath());
$show_graph = !phutil_nonempty_string($drequest->getPath());
if ($show_graph) {
$history_list
->setParents($history_results['parents'])
@ -98,11 +98,10 @@ final class DiffusionHistoryController extends DiffusionController {
$viewer = $this->getViewer();
$repository = $drequest->getRepository();
$no_path = !strlen($drequest->getPath());
if ($no_path) {
$header_text = pht('History');
} else {
if (phutil_nonempty_string($drequest->getPath())) {
$header_text = $this->renderPathLinks($drequest, $mode = 'history');
} else {
$header_text = pht('History');
}
$header = id(new PHUIHeaderView())

View file

@ -48,6 +48,9 @@ final class DiffusionPathIDQuery extends Phobject {
*/
public static function normalizePath($path) {
// Ensure we have a string, not a null.
$path = coalesce($path, '');
// Normalize to single slashes, e.g. "///" => "/".
$path = preg_replace('@[/]{2,}@', '/', $path);