Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Remove assignment from condition #870

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions include/branches.inc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ function get_all_branches() {

foreach ($GLOBALS['OLDRELEASES'] as $major => $releases) {
foreach ($releases as $version => $release) {
if ($branch = version_number_to_branch($version)) {
$branch = version_number_to_branch($version);

if ($branch) {
if (!isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) {
$branches[$major][$branch] = $release;
$branches[$major][$branch]['version'] = $version;
Expand All @@ -111,7 +113,9 @@ function get_all_branches() {

foreach ($GLOBALS['RELEASES'] as $major => $releases) {
foreach ($releases as $version => $release) {
if ($branch = version_number_to_branch($version)) {
$branch = version_number_to_branch($version);

if ($branch) {
if (!isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) {
$branches[$major][$branch] = $release;
$branches[$major][$branch]['version'] = $version;
Expand All @@ -134,7 +138,9 @@ function get_active_branches($include_recent_eols = true) {

foreach ($GLOBALS['RELEASES'] as $major => $releases) {
foreach ($releases as $version => $release) {
if ($branch = version_number_to_branch($version)) {
$branch = version_number_to_branch($version);

if ($branch) {
$threshold = get_branch_security_eol_date($branch);
if ($threshold === null) {
// No EOL date available, assume it is ancient.
Expand Down Expand Up @@ -169,7 +175,9 @@ function get_eol_branches($always_include = null) {
// Gather the last release on each branch into a convenient array.
foreach ($GLOBALS['OLDRELEASES'] as $major => $releases) {
foreach ($releases as $version => $release) {
if ($branch = version_number_to_branch($version)) {
$branch = version_number_to_branch($version);

if ($branch) {
if (!isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) {
$branches[$major][$branch] = [
'date' => strtotime($release['date']),
Expand All @@ -185,7 +193,9 @@ function get_eol_branches($always_include = null) {
* the $RELEASES array and not explicitly marked as EOL there". */
foreach ($GLOBALS['RELEASES'] as $major => $releases) {
foreach ($releases as $version => $release) {
if ($branch = version_number_to_branch($version)) {
$branch = version_number_to_branch($version);

if ($branch) {
if ($now < get_branch_security_eol_date($branch)) {
/* This branch isn't EOL: remove it from our array. */
if (isset($branches[$major][$branch])) {
Expand All @@ -208,7 +218,9 @@ function get_eol_branches($always_include = null) {

if (isset($GLOBALS['RELEASES'][$major][$version])) {
$release = $GLOBALS['RELEASES'][$major][$version];
if ($branch = version_number_to_branch($version)) {
$branch = version_number_to_branch($version);

if ($branch) {
$branches[$major][$branch] = [
'date' => strtotime($release['source'][0]['date']),
'link' => "/downloads#v$version",
Expand Down