Skip to content

Commit e0635e8

Browse files
committed
Fix test failed
1 parent 26b50b7 commit e0635e8

5 files changed

Lines changed: 41 additions & 98 deletions

File tree

include/release-qa.php

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,44 +128,60 @@
128128
// release : These are encouraged for use (e.g., linked at qa.php.net)
129129
// reported : These are allowed to report @ the php.qa.reports mailing list
130130

131-
(function(&$QA_RELEASES) use ($QA_CHECKSUM_TYPES) {
132-
foreach ($QA_RELEASES as $pversion => $info) {
131+
$process_qa_releases = /**
132+
* @param array<string, array{
133+
* active?: bool,
134+
* release: array{
135+
* type: string,
136+
* number: int,
137+
* sha256_bz2?: string,
138+
* sha256_gz?: string,
139+
* sha256_xz?: string,
140+
* date: string,
141+
* baseurl?: string
142+
* }
143+
* }> $qa_releases
144+
* @param list<string> $checksum_types
145+
* @return array<string, mixed>
146+
*/
147+
static function(array $qa_releases, array $checksum_types): array {
148+
foreach ($qa_releases as $pversion => $info) {
133149

134150
if (isset($info['active']) && $info['active']) {
135151

136152
// Allow -dev versions of all active types
137153
// Example: 5.3.6-dev
138-
$QA_RELEASES['reported'][] = "{$pversion}-dev";
139-
$QA_RELEASES[$pversion]['dev_version'] = "{$pversion}-dev";
154+
$qa_releases['reported'][] = "{$pversion}-dev";
155+
$qa_releases[$pversion]['dev_version'] = "{$pversion}-dev";
140156

141157
// Allow -dev version of upcoming qa releases (rc/alpha/beta)
142158
// @todo confirm this php version format for all dev versions
143159
if ((int)$info['release']['number'] > 0) {
144-
$QA_RELEASES['reported'][] = "{$pversion}{$info['release']['type']}{$info['release']['number']}";
160+
$qa_releases['reported'][] = "{$pversion}{$info['release']['type']}{$info['release']['number']}";
145161
if (!empty($info['release']['baseurl'])) {
146162

147163
// php.net filename format for qa releases
148164
// example: php-5.3.0RC2
149165
$fn_base = 'php-' . $pversion . $info['release']['type'] . $info['release']['number'];
150166

151-
$QA_RELEASES[$pversion]['release']['version'] = $pversion . $info['release']['type'] . $info['release']['number'];
167+
$qa_releases[$pversion]['release']['version'] = $pversion . $info['release']['type'] . $info['release']['number'];
152168
foreach ([ 'bz2', 'gz', 'xz' ] as $file_type) {
153-
foreach ($QA_CHECKSUM_TYPES as $algo) {
169+
foreach ($checksum_types as $algo) {
154170
if (isset($info['release'][$algo . '_' . $file_type])) {
155-
$QA_RELEASES[$pversion]['release']['files'][$file_type][$algo] = $info['release'][$algo . '_' . $file_type];
171+
$qa_releases[$pversion]['release']['files'][$file_type][$algo] = $info['release'][$algo . '_' . $file_type];
156172
}
157173
}
158-
if (!empty($QA_RELEASES[$pversion]['release']['files'][$file_type])) {
159-
$QA_RELEASES[$pversion]['release']['files'][$file_type]['path']= $info['release']['baseurl'] . $fn_base . '.tar.' . $file_type;
174+
if (!empty($qa_releases[$pversion]['release']['files'][$file_type])) {
175+
$qa_releases[$pversion]['release']['files'][$file_type]['path']= $info['release']['baseurl'] . $fn_base . '.tar.' . $file_type;
160176
}
161177
}
162178

163-
if (empty($QA_RELEASES[$pversion]['release']['files'])) {
164-
$QA_RELEASES[$pversion]['release']['enabled'] = false;
179+
if (empty($qa_releases[$pversion]['release']['files'])) {
180+
$qa_releases[$pversion]['release']['enabled'] = false;
165181
}
166182
}
167183
} else {
168-
$QA_RELEASES[$pversion]['release']['enabled'] = false;
184+
$qa_releases[$pversion]['release']['enabled'] = false;
169185
}
170186

171187
}
@@ -174,10 +190,14 @@
174190
// Sorted information for later use
175191
// @todo need these?
176192
// $QA_RELEASES['releases'] : All current versions with active qa releases
177-
foreach ($QA_RELEASES as $pversion => $info) {
193+
foreach ($qa_releases as $pversion => $info) {
178194
if (isset($info['active']) && $info['active'] && !empty($info['release']['number'])) {
179-
$QA_RELEASES['releases'][$pversion] = $info['release'];
195+
$qa_releases['releases'][$pversion] = $info['release'];
180196
}
181197
}
182198

183-
})($QA_RELEASES);
199+
return $qa_releases;
200+
};
201+
202+
$QA_RELEASES = $process_qa_releases($QA_RELEASES, $QA_CHECKSUM_TYPES);
203+
unset($process_qa_releases);

include/version.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ $RELEASES = (function () {
7070

7171
$ret = [];
7272
foreach ($data as $release) {
73+
$release += ['announcement' => true];
7374
$version = $release['version'];
7475
[$major] = explode('.', $version, 2);
7576

7677
$info = [
77-
'announcement' => $release['announcement'] ?? true,
78+
'announcement' => $release['announcement'],
7879
'tags' => $release['tags'],
7980
'date' => $release['date'],
8081
'source' => [],

phpstan-baseline.neon

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,60 +1002,6 @@ parameters:
10021002
count: 1
10031003
path: include/posttohost.inc
10041004

1005-
-
1006-
message: '#^Cannot access offset ''host'' on array\{scheme\?\: string, host\?\: string, port\?\: int\<0, 65535\>, user\?\: string, pass\?\: string, path\?\: string, query\?\: string, fragment\?\: string\}\|false\.$#'
1007-
identifier: offsetAccess.nonOffsetAccessible
1008-
count: 2
1009-
path: include/prepend.inc
1010-
1011-
-
1012-
message: '#^Comparison operation "\>" between 0 and 0 is always false\.$#'
1013-
identifier: greater.alwaysFalse
1014-
count: 1
1015-
path: include/release-qa.php
1016-
1017-
-
1018-
message: '#^Offset ''active'' on array\{active\: true, release\: array\{type\: ''RC'', number\: 0, sha256_bz2\: '''', sha256_gz\: '''', sha256_xz\: '''', date\: ''05 Dec 2024''\|''07 May 2026''\|''21 May 2026'', baseurl\: ''https\://downloads…''\}\|array\{type\: ''RC'', number\: 0, sha256_bz2\: '''', sha256_gz\: '''', sha256_xz\: '''', date\: ''28 May 2026'', baseurl\: ''https\://downloads…''\}\} in isset\(\) always exists and is not nullable\.$#'
1019-
identifier: isset.offset
1020-
count: 1
1021-
path: include/release-qa.php
1022-
1023-
-
1024-
message: '#^Offset ''baseurl'' on array\{type\: ''RC'', number\: 0, sha256_bz2\: '''', sha256_gz\: '''', sha256_xz\: '''', date\: ''05 Dec 2024''\|''07 May 2026''\|''21 May 2026'', baseurl\: ''https\://downloads…''\}\|array\{type\: ''RC'', number\: 0, sha256_bz2\: '''', sha256_gz\: '''', sha256_xz\: '''', date\: ''28 May 2026'', baseurl\: ''https\://downloads…''\} in empty\(\) always exists and is not falsy\.$#'
1025-
identifier: empty.offset
1026-
count: 1
1027-
path: include/release-qa.php
1028-
1029-
-
1030-
message: '#^Offset ''bz2''\|''gz''\|''xz'' on non\-empty\-array\{bz2\?\: array\{sha256\: '''', path\?\: ''https\://downloads…''\}, gz\?\: array\{sha256\: '''', path\?\: ''https\://downloads…''\}, xz\?\: array\{sha256\: '''', path\?\: ''https\://downloads…''\}\} in empty\(\) always exists and is not falsy\.$#'
1031-
identifier: empty.offset
1032-
count: 1
1033-
path: include/release-qa.php
1034-
1035-
-
1036-
message: '#^Offset ''files'' on array\{type\: ''RC'', number\: 0, sha256_bz2\: '''', sha256_gz\: '''', sha256_xz\: '''', date\: ''05 Dec 2024''\|''07 May 2026''\|''21 May 2026'', baseurl\: ''https\://downloads…'', enabled\?\: false, \.\.\.\}\|array\{type\: ''RC'', number\: 0, sha256_bz2\: '''', sha256_gz\: '''', sha256_xz\: '''', date\: ''28 May 2026'', baseurl\: ''https\://downloads…'', version\: ''8\.2\.27RC0''\|''8\.3\.31RC0''\|''8\.4\.22RC0''\|''8\.5\.7RC0'', \.\.\.\} in empty\(\) always exists and is not falsy\.$#'
1037-
identifier: empty.offset
1038-
count: 1
1039-
path: include/release-qa.php
1040-
1041-
-
1042-
message: '#^Offset ''number'' on array\{type\: ''RC'', number\: 0, sha256_bz2\: '''', sha256_gz\: '''', sha256_xz\: '''', date\: ''05 Dec 2024''\|''07 May 2026''\|''21 May 2026'', baseurl\: ''https\://downloads…'', enabled\: false\}\|array\{type\: ''RC'', number\: 0, sha256_bz2\: '''', sha256_gz\: '''', sha256_xz\: '''', date\: ''28 May 2026'', baseurl\: ''https\://downloads…'', enabled\: false\} in empty\(\) always exists and is always falsy\.$#'
1043-
identifier: empty.offset
1044-
count: 1
1045-
path: include/release-qa.php
1046-
1047-
-
1048-
message: '#^Offset ''sha256_bz2''\|''sha256_gz''\|''sha256_xz'' on array\{type\: ''RC'', number\: 0, sha256_bz2\: '''', sha256_gz\: '''', sha256_xz\: '''', date\: ''05 Dec 2024''\|''07 May 2026''\|''21 May 2026'', baseurl\: ''https\://downloads…''\}\|array\{type\: ''RC'', number\: 0, sha256_bz2\: '''', sha256_gz\: '''', sha256_xz\: '''', date\: ''28 May 2026'', baseurl\: ''https\://downloads…''\} in isset\(\) always exists and is not nullable\.$#'
1049-
identifier: isset.offset
1050-
count: 1
1051-
path: include/release-qa.php
1052-
1053-
-
1054-
message: '#^Right side of && is always true\.$#'
1055-
identifier: booleanAnd.rightAlwaysTrue
1056-
count: 2
1057-
path: include/release-qa.php
1058-
10591005
-
10601006
message: '#^Function autogen\(\) has no return type specified\.$#'
10611007
identifier: missingType.return
@@ -1326,12 +1272,6 @@ parameters:
13261272
count: 1
13271273
path: include/version.inc
13281274

1329-
-
1330-
message: '#^Offset ''announcement'' on array\{version\: ''8\.2\.31'', date\: ''07 May 2026'', tags\: array\{''security''\}, sha256\: array\{''tar\.gz''\: ''083c2f61cc5f527eb29…'', ''tar\.bz2''\: ''948183fa04cf261c9b9…'', ''tar\.xz''\: ''95eae411d594fe6f6e5…''\}\}\|array\{version\: ''8\.3\.31'', date\: ''07 May 2026'', tags\: array\{''security''\}, sha256\: array\{''tar\.gz''\: ''4e7baaf0a690e954a20…'', ''tar\.bz2''\: ''e6986b1fd37eb254021…'', ''tar\.xz''\: ''66410cee07f4b2baeb0…''\}\}\|array\{version\: ''8\.4\.22'', date\: ''04 Jun 2026'', tags\: array\{\}, sha256\: array\{''tar\.gz''\: ''a012c2c9724baf214a7…'', ''tar\.bz2''\: ''4b16e7e2c384ce25e07…'', ''tar\.xz''\: ''696c0f6ad92e94c5905…''\}\}\|array\{version\: ''8\.5\.7'', date\: ''04 Jun 2026'', tags\: array\{\}, sha256\: array\{''tar\.gz''\: ''e5eba93fd6dd3241d0e…'', ''tar\.bz2''\: ''4ef9355f784d4b32015…'', ''tar\.xz''\: ''01ba2ed1c2658dacf91…''\}\} on left side of \?\? does not exist\.$#'
1331-
identifier: nullCoalesce.offset
1332-
count: 1
1333-
path: include/version.inc
1334-
13351275
-
13361276
message: '#^Parameter \#3 \$length of function substr expects int\|null, int\|false given\.$#'
13371277
identifier: argument.type
@@ -1722,12 +1662,6 @@ parameters:
17221662
count: 1
17231663
path: public/credits.php
17241664

1725-
-
1726-
message: '#^Parameter \#2 \$subject of function preg_match expects string, string\|false given\.$#'
1727-
identifier: argument.type
1728-
count: 1
1729-
path: public/credits.php
1730-
17311665
-
17321666
message: '#^Variable \$LANG might not be defined\.$#'
17331667
identifier: variable.undefined
@@ -1788,12 +1722,6 @@ parameters:
17881722
count: 1
17891723
path: public/downloads.php
17901724

1791-
-
1792-
message: '#^Result of && is always true\.$#'
1793-
identifier: booleanAnd.alwaysTrue
1794-
count: 1
1795-
path: public/downloads.php
1796-
17971725
-
17981726
message: '#^Variable \$MYSITE might not be defined\.$#'
17991727
identifier: variable.undefined
@@ -2406,12 +2334,6 @@ parameters:
24062334
count: 1
24072335
path: public/submit-event.php
24082336

2409-
-
2410-
message: '#^Offset ''email'' on non\-empty\-array\<mixed\> in isset\(\) always exists and is not nullable\.$#'
2411-
identifier: isset.offset
2412-
count: 1
2413-
path: public/submit-event.php
2414-
24152337
-
24162338
message: '#^Offset ''scheme'' might not exist on array\{scheme\?\: string, host\: non\-falsy\-string, port\?\: int\<0, 65535\>, user\?\: string, pass\?\: string, path\?\: string, query\?\: string, fragment\?\: string\}\.$#'
24172339
identifier: offsetAccess.notFound

public/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
the display of the index page). The cost of stat'ing
2626
them all is prohibitive.
2727
*/
28-
$timestamps[] = @filemtime("include/prepend.inc");
28+
$timestamps[] = @filemtime("../include/prepend.inc");
2929

3030
// These are the only dynamic parts of the frontpage
3131
$timestamps[] = @filemtime("include/pregen-confs.inc");
3232
$timestamps[] = @filemtime("include/pregen-news.inc");
33-
$timestamps[] = @filemtime("include/version.inc");
33+
$timestamps[] = @filemtime("../include/version.inc");
3434
$timestamps[] = @filemtime("js/common.js");
3535

3636
// The latest of these modification dates is our real Last-Modified date

public/releases/active.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
$_SERVER['BASE_PAGE'] = 'releases/active.php';
66

77
require_once __DIR__ . '/../../include/prepend.inc';
8-
require_once ProjectGlobals::getProjectRoot(). '/include/branches.inc';
8+
require_once ProjectGlobals::getProjectRoot() . '/include/branches.inc';
99

1010
header('Content-Type: application/json; charset=UTF-8');
1111
header('Cache-Control: public, max-age=900');

0 commit comments

Comments
 (0)