Skip to content
Draft
Show file tree
Hide file tree
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
52 changes: 36 additions & 16 deletions include/release-qa.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,44 +128,60 @@
// release : These are encouraged for use (e.g., linked at qa.php.net)
// reported : These are allowed to report @ the php.qa.reports mailing list

(function(&$QA_RELEASES) use ($QA_CHECKSUM_TYPES) {
foreach ($QA_RELEASES as $pversion => $info) {
$process_qa_releases = /**
* @param array<string, array{
* active?: bool,
* release: array{
* type: string,
* number: int,
* sha256_bz2?: string,
* sha256_gz?: string,
* sha256_xz?: string,
* date: string,
* baseurl?: string
* }
* }> $qa_releases
* @param list<string> $checksum_types
* @return array<string, mixed>
*/
static function(array $qa_releases, array $checksum_types): array {
foreach ($qa_releases as $pversion => $info) {

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

// Allow -dev versions of all active types
// Example: 5.3.6-dev
$QA_RELEASES['reported'][] = "{$pversion}-dev";
$QA_RELEASES[$pversion]['dev_version'] = "{$pversion}-dev";
$qa_releases['reported'][] = "{$pversion}-dev";
$qa_releases[$pversion]['dev_version'] = "{$pversion}-dev";

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

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

$QA_RELEASES[$pversion]['release']['version'] = $pversion . $info['release']['type'] . $info['release']['number'];
$qa_releases[$pversion]['release']['version'] = $pversion . $info['release']['type'] . $info['release']['number'];
foreach ([ 'bz2', 'gz', 'xz' ] as $file_type) {
foreach ($QA_CHECKSUM_TYPES as $algo) {
foreach ($checksum_types as $algo) {
if (isset($info['release'][$algo . '_' . $file_type])) {
$QA_RELEASES[$pversion]['release']['files'][$file_type][$algo] = $info['release'][$algo . '_' . $file_type];
$qa_releases[$pversion]['release']['files'][$file_type][$algo] = $info['release'][$algo . '_' . $file_type];
}
}
if (!empty($QA_RELEASES[$pversion]['release']['files'][$file_type])) {
$QA_RELEASES[$pversion]['release']['files'][$file_type]['path']= $info['release']['baseurl'] . $fn_base . '.tar.' . $file_type;
if (!empty($qa_releases[$pversion]['release']['files'][$file_type])) {
$qa_releases[$pversion]['release']['files'][$file_type]['path']= $info['release']['baseurl'] . $fn_base . '.tar.' . $file_type;
}
}

if (empty($QA_RELEASES[$pversion]['release']['files'])) {
$QA_RELEASES[$pversion]['release']['enabled'] = false;
if (empty($qa_releases[$pversion]['release']['files'])) {
$qa_releases[$pversion]['release']['enabled'] = false;
}
}
} else {
$QA_RELEASES[$pversion]['release']['enabled'] = false;
$qa_releases[$pversion]['release']['enabled'] = false;
}

}
Expand All @@ -174,10 +190,14 @@
// Sorted information for later use
// @todo need these?
// $QA_RELEASES['releases'] : All current versions with active qa releases
foreach ($QA_RELEASES as $pversion => $info) {
foreach ($qa_releases as $pversion => $info) {
if (isset($info['active']) && $info['active'] && !empty($info['release']['number'])) {
$QA_RELEASES['releases'][$pversion] = $info['release'];
$qa_releases['releases'][$pversion] = $info['release'];
}
}

})($QA_RELEASES);
return $qa_releases;
};

$QA_RELEASES = $process_qa_releases($QA_RELEASES, $QA_CHECKSUM_TYPES);
unset($process_qa_releases);
3 changes: 2 additions & 1 deletion include/version.inc
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ $RELEASES = (function () {

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

$info = [
'announcement' => $release['announcement'] ?? true,
'announcement' => $release['announcement'],
'tags' => $release['tags'],
'date' => $release['date'],
'source' => [],
Expand Down
78 changes: 0 additions & 78 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1002,60 +1002,6 @@ parameters:
count: 1
path: include/posttohost.inc

-
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\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 2
path: include/prepend.inc

-
message: '#^Comparison operation "\>" between 0 and 0 is always false\.$#'
identifier: greater.alwaysFalse
count: 1
path: include/release-qa.php

-
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\.$#'
identifier: isset.offset
count: 1
path: include/release-qa.php

-
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\.$#'
identifier: empty.offset
count: 1
path: include/release-qa.php

-
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\.$#'
identifier: empty.offset
count: 1
path: include/release-qa.php

-
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\.$#'
identifier: empty.offset
count: 1
path: include/release-qa.php

-
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\.$#'
identifier: empty.offset
count: 1
path: include/release-qa.php

-
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\.$#'
identifier: isset.offset
count: 1
path: include/release-qa.php

-
message: '#^Right side of && is always true\.$#'
identifier: booleanAnd.rightAlwaysTrue
count: 2
path: include/release-qa.php

-
message: '#^Function autogen\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -1326,12 +1272,6 @@ parameters:
count: 1
path: include/version.inc

-
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\.$#'
identifier: nullCoalesce.offset
count: 1
path: include/version.inc

-
message: '#^Parameter \#3 \$length of function substr expects int\|null, int\|false given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -1722,12 +1662,6 @@ parameters:
count: 1
path: public/credits.php

-
message: '#^Parameter \#2 \$subject of function preg_match expects string, string\|false given\.$#'
identifier: argument.type
count: 1
path: public/credits.php

-
message: '#^Variable \$LANG might not be defined\.$#'
identifier: variable.undefined
Expand Down Expand Up @@ -1788,12 +1722,6 @@ parameters:
count: 1
path: public/downloads.php

-
message: '#^Result of && is always true\.$#'
identifier: booleanAnd.alwaysTrue
count: 1
path: public/downloads.php

-
message: '#^Variable \$MYSITE might not be defined\.$#'
identifier: variable.undefined
Expand Down Expand Up @@ -2406,12 +2334,6 @@ parameters:
count: 1
path: public/submit-event.php

-
message: '#^Offset ''email'' on non\-empty\-array\<mixed\> in isset\(\) always exists and is not nullable\.$#'
identifier: isset.offset
count: 1
path: public/submit-event.php

-
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\}\.$#'
identifier: offsetAccess.notFound
Expand Down
4 changes: 2 additions & 2 deletions public/images/supported-versions.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require_once __DIR__ . '/../include/prepend.inc';
require_once __DIR__ . '/../include/branches.inc';
require_once __DIR__ . '/../../include/prepend.inc';
require_once __DIR__ . '/../../include/branches.inc';

// Sizing constants.
$margin_left = 80;
Expand Down
10 changes: 5 additions & 5 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
the display of the index page). The cost of stat'ing
them all is prohibitive.
*/
$timestamps[] = @filemtime("include/prepend.inc");
$timestamps[] = @filemtime("../include/prepend.inc");

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

// The latest of these modification dates is our real Last-Modified date
Expand All @@ -52,7 +52,7 @@
$_SERVER['BASE_PAGE'] = 'index.php';
require_once __DIR__ . '/../include/prepend.inc';
require_once __DIR__ . '/../include/branches.inc';
require_once __DIR__ . '/include/pregen-confs.inc';
require_once __DIR__ . '/../include/pregen-confs.inc';
require_once __DIR__ . '/../include/version.inc';

mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60 * 60 * 24 * 365);
Expand Down
2 changes: 1 addition & 1 deletion public/releases/active.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$_SERVER['BASE_PAGE'] = 'releases/active.php';

require_once __DIR__ . '/../../include/prepend.inc';
require_once ProjectGlobals::getProjectRoot(). '/include/branches.inc';
require_once __DIR__ . '/../../include/branches.inc';

header('Content-Type: application/json; charset=UTF-8');

Expand Down
2 changes: 1 addition & 1 deletion src/News/NewsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getNewsByYear(int $year): array
public function getPregeneratedNews(): array
{
$NEWS_ENTRIES = null;
include __DIR__ . '/../../public/include/pregen-news.inc';
include __DIR__ . '/../../include/pregen-news.inc';

return is_array($NEWS_ENTRIES) ? $NEWS_ENTRIES : [];
}
Expand Down