[PHP-WEBMASTER] [web-php] master: Fix test failed (#1992)

Author: Luffy (sy-records)
Committer: GitHub (web-flow)
Pusher: sy-records
Date: 2026-09-01T10:47:00+08:00

Commit: Fix test failed (#1992) · php/web-php@666e0e4 · GitHub
Raw diff: https://github.com/php/web-php/commit/666e0e4a6be4d3ab8f1c7f06a7ad6b8dc46dc77a.diff

Fix test failed (#1992)

Changed paths:
  M include/release-qa.php
  M include/version.inc
  M phpstan-baseline.neon
  M public/images/supported-versions.php
  M public/index.php
  M public/releases/active.php
  M public/releases/index.php
  M public/supported-versions.php

Diff:

diff --git a/include/release-qa.php b/include/release-qa.php
index 7c6a913f26..eec051fcd8 100644
--- a/include/release-qa.php
+++ b/include/release-qa.php
@@ -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;
             }

         }
@@ -173,11 +189,15 @@

     // Sorted information for later use
     // @todo need these?
- // $QA_RELEASES['releases'] : All current versions with active qa releases
- foreach ($QA_RELEASES as $pversion => $info) {
+ // $qa_releases['releases'] : All current versions with active qa releases
+ 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);
diff --git a/include/version.inc b/include/version.inc
index 9e3ad2beb9..d5b521d83a 100644
--- a/include/version.inc
+++ b/include/version.inc
@@ -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' => [],
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index b9444947e1..1be2fec354 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -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
@@ -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
@@ -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
@@ -1764,36 +1698,12 @@ parameters:
       count: 1
       path: public/downloads-get-instructions.php

- -
- message: '#^Call to function array_key_exists\(\) with ''os'' and non\-empty\-array will always evaluate to true\.$#'
- identifier: function.alreadyNarrowedType
- count: 2
- path: public/downloads.php
-
- -
- message: '#^Call to function array_key_exists\(\) with ''osvariant'' and non\-empty\-array will always evaluate to true\.$#'
- identifier: function.alreadyNarrowedType
- count: 1
- path: public/downloads.php
-
- -
- message: '#^Call to function array_key_exists\(\) with ''version'' and non\-empty\-array will always evaluate to true\.$#'
- identifier: function.alreadyNarrowedType
- count: 1
- path: public/downloads.php
-
     -
       message: '#^Function option\(\) has parameter \$attributes with no type specified\.$#'
       identifier: missingType.parameter
       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
@@ -2406,12 +2316,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
diff --git a/public/images/supported-versions.php b/public/images/supported-versions.php
index 5e16e15d73..1e14c87afe 100644
--- a/public/images/supported-versions.php
+++ b/public/images/supported-versions.php
@@ -2,7 +2,7 @@
use phpweb\ProjectGlobals;

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

// Sizing constants.
$margin_left = 80;
diff --git a/public/index.php b/public/index.php
index 95dc01ddf4..adb9153b6d 100644
--- a/public/index.php
+++ b/public/index.php
@@ -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/version.inc");
$timestamps[] = @filemtime("js/common.js");

// The latest of these modification dates is our real Last-Modified date
diff --git a/public/releases/active.php b/public/releases/active.php
index d9ac8fb0d0..61f282c405 100644
--- a/public/releases/active.php
+++ b/public/releases/active.php
@@ -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 ProjectGlobals::getProjectRoot() . '/include/branches.inc';

header('Content-Type: application/json; charset=UTF-8');
header('Cache-Control: public, max-age=900');
diff --git a/public/releases/index.php b/public/releases/index.php
index e87e49df4c..e6f0bf2968 100644
--- a/public/releases/index.php
+++ b/public/releases/index.php
@@ -4,7 +4,7 @@

$_SERVER['BASE_PAGE'] = 'releases/index.php';
require_once __DIR__ . '/../../include/prepend.inc';
-require_once ProjectGlobals::getProjectRoot(). '/include/branches.inc';
+require_once ProjectGlobals::getProjectRoot() . '/include/branches.inc';

if (isset($_GET["serialize"]) || isset($_GET["json"])) {
     $RELEASES = $RELEASES + $OLDRELEASES;
diff --git a/public/supported-versions.php b/public/supported-versions.php
index 8912bc7623..9383106b73 100644
--- a/public/supported-versions.php
+++ b/public/supported-versions.php
@@ -5,7 +5,7 @@
$_SERVER['BASE_PAGE'] = 'supported-versions.php';

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

site_header(
   'Supported Versions',