From c7bc14dd6b0017b166066f52ed2158fe6ba5afd2 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 14 Feb 2025 15:10:31 +0100 Subject: [PATCH 1/2] Prevent using system DLLs when running the tests The search order for DLLs on Windows is (simplified): * the application folder * the system folder * all folders in the `PATH` (The full details are documented on Microsoft Learn[1].) As is, we're adding `deps\bin` to the `PATH` when running the tests, but any DLLs in the system folder take precedence, so these would be used instead of our intended dependencies. To mitigate that, we copy over all DLLs from `deps\bin` to our application folder (i.e. where php.exe, php-cgi.exe and phpdbg.exe are placed). Since we're doing this, there is no more need to attempt to remove the OpenSSL DLLs in the system folder (what seems to be a bad idea anyway). [1] Closes GH-17805. --- .github/scripts/windows/build_task.bat | 5 ----- .github/scripts/windows/test_task.bat | 2 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/scripts/windows/build_task.bat b/.github/scripts/windows/build_task.bat index e8d84b8c0bfd6..071c0c28f5ac5 100644 --- a/.github/scripts/windows/build_task.bat +++ b/.github/scripts/windows/build_task.bat @@ -5,11 +5,6 @@ if /i "%GITHUB_ACTIONS%" neq "True" ( exit /b 3 ) -del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL -if %errorlevel% neq 0 exit /b 3 -del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL -if %errorlevel% neq 0 exit /b 3 - call %~dp0find-target-branch.bat set STABILITY=staging set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH% diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat index 0bfdaf664125b..5762aa32414e4 100644 --- a/.github/scripts/windows/test_task.bat +++ b/.github/scripts/windows/test_task.bat @@ -137,6 +137,8 @@ for %%i in (ldap oci8_12c pdo_oci) do ( set TEST_PHPDBG_EXECUTABLE=%PHP_BUILD_DIR%\phpdbg.exe +copy /-y %DEPS_DIR%\bin\*.dll %PHP_BUILD_DIR%\* + mkdir c:\tests_tmp nmake test TESTS="%OPCACHE_OPTS% -g FAIL,BORK,LEAK,XLEAK --no-progress -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp --bless %PARALLEL%" From 765cebf73a70f4fcd406b0bd44255358db377dc6 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 11 Feb 2025 20:07:26 +0100 Subject: [PATCH 2/2] Adapt tests to Windows 11 Apparently, one of the more recent patch releases of Windows 10 (confirmed for Windows 10.0.26100, but may affect older versions, too) changed treatment of filenames with trailing slashes to be recognized explicitly as directories, and no longer as invalid file or directory. We adapt the affected test cases. Closes GH-17804. --- ext/standard/tests/file/rename_variation-win32.phpt | 2 +- ext/standard/tests/file/unlink_variation8-win32.phpt | 4 ++-- ext/standard/tests/file/unlink_variation9-win32.phpt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/standard/tests/file/rename_variation-win32.phpt b/ext/standard/tests/file/rename_variation-win32.phpt index dc7586d5042b7..a348438bed556 100644 --- a/ext/standard/tests/file/rename_variation-win32.phpt +++ b/ext/standard/tests/file/rename_variation-win32.phpt @@ -61,7 +61,7 @@ bool(false) bool(true) -- Iteration 2 -- -Warning: rename(%s/rename_variation-win32/rename_variation.tmp/,%s/rename_variation2.tmp): The filename, directory name, or volume label syntax is incorrect (code: 123) in %s on line %d +Warning: rename(%s/rename_variation-win32/rename_variation.tmp/,%s/rename_variation2.tmp): %rThe filename, directory name, or volume label syntax is incorrect|The directory name is invalid%r (code: %r123|267%r) in %s on line %d bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/file/unlink_variation8-win32.phpt b/ext/standard/tests/file/unlink_variation8-win32.phpt index 12ace11fc196c..016beddce1c13 100644 --- a/ext/standard/tests/file/unlink_variation8-win32.phpt +++ b/ext/standard/tests/file/unlink_variation8-win32.phpt @@ -95,10 +95,10 @@ file removed Warning: unlink(%s/BADDIR/file.tmp): No such file or directory in %s on line %d -- removing unlinkVar8.tmp/file.tmp/ -- -Warning: unlink(unlinkVar8.tmp/file.tmp/): No such file or directory in %s on line %d +Warning: unlink(unlinkVar8.tmp/file.tmp/): %rNo such file or directory|Not a directory%r in %s on line %d -- removing %s/unlinkVar8.tmp/file.tmp/ -- -Warning: unlink(%s/unlinkVar8.tmp/file.tmp/): No such file or directory in %s on line %d +Warning: unlink(%s/unlinkVar8.tmp/file.tmp/): %rNo such file or directory|Not a directory%r in %s on line %d -- removing unlinkVar8.tmp//file.tmp -- file removed -- removing %s//unlinkVar8.tmp//file.tmp -- diff --git a/ext/standard/tests/file/unlink_variation9-win32.phpt b/ext/standard/tests/file/unlink_variation9-win32.phpt index a69c27088e94a..68e11be927637 100644 --- a/ext/standard/tests/file/unlink_variation9-win32.phpt +++ b/ext/standard/tests/file/unlink_variation9-win32.phpt @@ -97,10 +97,10 @@ file removed Warning: unlink(%s\BADDIR\file.tmp): No such file or directory in %s on line %d -- removing unlinkVar9.tmp\file.tmp\ -- -Warning: unlink(unlinkVar9.tmp\file.tmp\): No such file or directory in %s on line %d +Warning: unlink(unlinkVar9.tmp\file.tmp\): %rNo such file or directory|Not a directory%r in %s on line %d -- removing %s\unlinkVar9.tmp\file.tmp\ -- -Warning: unlink(%s\unlinkVar9.tmp\file.tmp\): No such file or directory in %s on line %d +Warning: unlink(%s\unlinkVar9.tmp\file.tmp\): %rNo such file or directory|Not a directory%r in %s on line %d -- removing unlinkVar9.tmp\\file.tmp -- file removed -- removing %s\\unlinkVar9.tmp\\file.tmp --