Author: Shivam Mathur (shivammathur)
Date: 2026-04-10T14:29:54+05:30

Commit: 
https://github.com/php/web-downloads/commit/87117fed70cd6de13276f14080eaa1af8363b9b1
Raw diff: 
https://github.com/php/web-downloads/commit/87117fed70cd6de13276f14080eaa1af8363b9b1.diff

Make sure PHP series files for dev versions is synced in Winlibs

Changed paths:
  M  config/vs.json
  M  src/Console/Command/WinlibsCommand.php
  M  tests/Console/Command/WinlibsCommandTest.php


Diff:

diff --git a/config/vs.json b/config/vs.json
index 27ebb27..6bfa639 100644
--- a/config/vs.json
+++ b/config/vs.json
@@ -1,4 +1,8 @@
 {
+    "dev": [
+        "8.5",
+        "8.6"
+    ],
     "7.1": "vc14",
     "7.2": "vc15",
     "7.3": "vc15",
diff --git a/src/Console/Command/WinlibsCommand.php 
b/src/Console/Command/WinlibsCommand.php
index e719920..d0c770c 100644
--- a/src/Console/Command/WinlibsCommand.php
+++ b/src/Console/Command/WinlibsCommand.php
@@ -137,6 +137,13 @@ private function updatePhpSeriesFiles(
         $php_versions = explode(',', $php_versions);
         $vs_version_targets = explode(',', $vs_version_targets);
         $stability_values = explode(',', $stability);
+        $vsConfig = json_decode(
+            file_get_contents(dirname(__DIR__, 3) . '/config/vs.json'),
+            true,
+            512,
+            JSON_THROW_ON_ERROR
+        );
+        $devVersions = $vsConfig['dev'] ?? [];
 
         $baseDirectory = $this->baseDirectory . "/php-sdk/deps/series";
 
@@ -145,8 +152,12 @@ private function updatePhpSeriesFiles(
         }
 
         foreach ($php_versions as $php_version) {
+            $stabilityValues = $stability_values;
+            if (in_array($php_version, $devVersions, true)) {
+                $stabilityValues = ['stable', 'staging'];
+            }
             foreach ($vs_version_targets as $vs_version_target) {
-                foreach ($stability_values as $stability_value) {
+                foreach ($stabilityValues as $stability_value) {
                     foreach ($files as $file) {
                         $fileName = str_replace($file['artifact_name'], 
$library, $file['file_name']);
                         $arch = $file['arch'];
@@ -189,4 +200,4 @@ private function updatePackagesFile(array $files, string 
$library): void
 
         file_put_contents($packagesFile, implode("\n", $fileLines));
     }
-}
\ No newline at end of file
+}
diff --git a/tests/Console/Command/WinlibsCommandTest.php 
b/tests/Console/Command/WinlibsCommandTest.php
index d5382a1..9334dbe 100644
--- a/tests/Console/Command/WinlibsCommandTest.php
+++ b/tests/Console/Command/WinlibsCommandTest.php
@@ -238,6 +238,49 @@ public static function versionProvider(): array
         ];
     }
 
+    public function 
testSyncsStableAndStagingSeriesFilesForConfiguredUpcomingSeries(): void
+    {
+        mkdir($this->winlibsDirectory . '/lib', 0755, true);
+
+        $library = 'lib';
+        $ref = '2.0.0';
+        $phpVersion = '8.5';
+        $vsVersion = 'vs17';
+        $arch = 'x64';
+
+        file_put_contents($this->winlibsDirectory . '/lib/data.json', 
json_encode([
+            'type' => 'php',
+            'library' => $library,
+            'ref' => $ref,
+            'vs_version_targets' => $vsVersion,
+            'php_versions' => $phpVersion,
+            'stability' => 'staging'
+        ]));
+
+        $zipPath = $this->winlibsDirectory . 
"/lib/lib-$ref-$vsVersion-$arch.zip";
+        $zip = new ZipArchive();
+        if ($zip->open($zipPath, ZipArchive::CREATE) === TRUE) {
+            $zip->addFromString("dummy_file.txt", "dummy content");
+            $zip->close();
+        }
+
+        $command = new WinlibsCommand();
+        $command->setOption('base-directory', $this->baseDirectory);
+        $command->setOption('builds-directory', $this->buildsDirectory);
+
+        $result = $command->handle();
+
+        $this->assertSame(0, $result);
+        $this->assertStringEqualsFile(
+            $this->baseDirectory . 
"/php-sdk/deps/series/packages-$phpVersion-$vsVersion-$arch-stable.txt",
+            "lib-$ref-$vsVersion-$arch.zip"
+        );
+        $this->assertStringEqualsFile(
+            $this->baseDirectory . 
"/php-sdk/deps/series/packages-$phpVersion-$vsVersion-$arch-staging.txt",
+            "lib-$ref-$vsVersion-$arch.zip"
+        );
+    }
+
     public function testCommandHandlesMissingBaseDirectory(): void
     {
         $command = new WinlibsCommand();

Reply via email to