@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.

Change erroneous loose comparison to strict comparison in tab panels

Summary:
Fix a loose comparison causing a bug when comparing the selected tab (0) with a tab which has an alphanumeric ID which doesn't begin with an integer.

E.g., `(0 == 'kq3p37awi2n5')` is true in PHP 7.4 and below, this can sometimes cause multiple tabs to be displayed when a tab panel is first loaded onto a page:

{F278735}

Test Plan: Create a tab panel with at least 3 tabs, add a couple more and ensure that multiple tabs aren't loaded.

Reviewers: O1 Blessed Committers, valerio.bozzolan, Cigaryno, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, Cigaryno, avivey

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

Maniphest Tasks: T15146

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

authored by

dylsss and committed by
Valerio Bozzolan
cbc0e661 6b8ec501

+4 -2
+4 -2
src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php
··· 111 111 $name = pht('Unnamed Tab'); 112 112 } 113 113 114 + $is_selected = (string)$idx === (string)$selected; 115 + 114 116 $tab_view = id(new PHUIListItemView()) 115 117 ->setHref('#') 116 - ->setSelected((string)$idx === (string)$selected) 118 + ->setSelected($is_selected) 117 119 ->addSigil('dashboard-tab-panel-tab') 118 120 ->setMetadata(array('panelKey' => $idx)) 119 121 ->setName($name); ··· 286 288 'div', 287 289 array( 288 290 'id' => $content_id, 289 - 'style' => ($idx == $selected) ? null : 'display: none', 291 + 'style' => $is_selected ? null : 'display: none', 290 292 ), 291 293 $panel_content); 292 294