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:
parent
fa687b4ba0
commit
1802ebd2cc
2 changed files with 7 additions and 5 deletions
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue