From 1088c7de1a2c7847edddc6ba8b8eb1dc47cd1991 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Wed, 20 May 2026 19:30:16 +0530 Subject: [PATCH 1/3] Make curl brotli and zstd optional on Windows (#21925) This allows builds with older curl versions to continue without these dependencies, while also supporting static library names when they are present. Co-authored-by: Jan Ehrhardt <1757825+Jan-E@users.noreply.github.com> --- ext/curl/config.w32 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ext/curl/config.w32 b/ext/curl/config.w32 index eda7604bc118..14ae1a28ab12 100644 --- a/ext/curl/config.w32 +++ b/ext/curl/config.w32 @@ -24,11 +24,18 @@ if (PHP_CURL != "no") { (ver_num <= parseInt("0x073b00") || ver_num > parseInt("0x073b00") && CHECK_LIB("normaliz.lib", "curl", PHP_CURL) && CHECK_LIB("libssh2.lib", "curl", PHP_CURL) && - CHECK_LIB("nghttp2.lib", "curl", PHP_CURL) && - CHECK_LIB("brotlidec.lib", "curl", PHP_CURL) && - CHECK_LIB("brotlicommon.lib", "curl", PHP_CURL) && - CHECK_LIB("libzstd.lib", "curl", PHP_CURL)) + CHECK_LIB("nghttp2.lib", "curl", PHP_CURL)) ) { + if (!(CHECK_HEADER_ADD_INCLUDE("brotli/decode.h", "CFLAGS_CURL") && + CHECK_LIB("brotlidec.lib;brotlidec-static.lib", "curl", PHP_CURL) && + CHECK_LIB("brotlicommon.lib;brotlicommon-static.lib", "curl", PHP_CURL) + )) { + WARNING("brotli in curl not enabled; libraries or headers not found"); + } + if (!(CHECK_LIB("libzstd.lib;libzstd_a.lib", "curl", PHP_CURL) + )) { + WARNING("zstd in curl not enabled; library not found"); + } EXTENSION("curl", "interface.c multi.c share.c curl_file.c"); AC_DEFINE('HAVE_CURL', 1, 'Have cURL library'); ADD_FLAG("CFLAGS_CURL", "/D CURL_STATICLIB /D PHP_CURL_EXPORTS=1"); From a03961b187f957c67bdf43238556cce6899d652a Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Wed, 20 May 2026 20:01:06 +0530 Subject: [PATCH 2/3] Switch to VS18 for the master branch (#22094) --- .github/actions/setup-windows/action.yml | 3 ++- .github/matrix.php | 8 +++++--- .github/scripts/windows/find-vs-toolset.bat | 7 +++++-- .github/workflows/test-suite.yml | 4 ++-- ext/com_dotnet/tests/variants.phpt | 10 +++++----- win32/build/confutils.js | 4 ++-- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/actions/setup-windows/action.yml b/.github/actions/setup-windows/action.yml index e0a3fd4e7d31..a5fa4cdddcb1 100644 --- a/.github/actions/setup-windows/action.yml +++ b/.github/actions/setup-windows/action.yml @@ -16,5 +16,6 @@ runs: - name: Setup PostgreSQL shell: pwsh run: | - Set-Service -Name "postgresql-x64-14" -StartupType manual -Status Running + $postgresService = if ($env:PHP_BUILD_CRT -eq "vs18") { "postgresql-x64-17" } else { "postgresql-x64-14" } + Set-Service -Name $postgresService -StartupType manual -Status Running pwsh -Command { $env:PGPASSWORD="root"; & "$env:PGBIN\psql" -U postgres -c "ALTER USER postgres WITH PASSWORD 'Password12!';" } diff --git a/.github/matrix.php b/.github/matrix.php index eb10492d17f5..111aebfb94d1 100644 --- a/.github/matrix.php +++ b/.github/matrix.php @@ -153,9 +153,11 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re } } $jobs['WINDOWS']['matrix'] = ['include' => $matrix]; - $jobs['WINDOWS']['config'] = version_compare($php_version, '8.4', '>=') - ? ['vs_crt_version' => 'vs17'] - : ['vs_crt_version' => 'vs16']; + $jobs['WINDOWS']['config'] = match (true) { + version_compare($php_version, '8.6', '>=') => ['vs_crt_version' => 'vs18', 'runs_on' => 'windows-2025-vs2026'], + version_compare($php_version, '8.4', '>=') => ['vs_crt_version' => 'vs17', 'runs_on' => 'windows-2022'], + default => ['vs_crt_version' => 'vs16', 'runs_on' => 'windows-2022'], + }; } if ($all_jobs || !$no_jobs || $test_freebsd) { $jobs['FREEBSD']['matrix'] = $all_variations && version_compare($php_version, '8.3', '>=') diff --git a/.github/scripts/windows/find-vs-toolset.bat b/.github/scripts/windows/find-vs-toolset.bat index 2d9e68e73031..ecaca6775b07 100644 --- a/.github/scripts/windows/find-vs-toolset.bat +++ b/.github/scripts/windows/find-vs-toolset.bat @@ -3,7 +3,7 @@ setlocal enabledelayedexpansion if "%~1"=="" ( - echo ERROR: Usage: %~nx0 [vc14^|vc15^|vs16^|vs17] + echo ERROR: Usage: %~nx0 [vc14^|vc15^|vs16^|vs17^|vs18] exit /b 1 ) @@ -11,6 +11,7 @@ set "toolsets_vc14=14.0" set "toolsets_vc15=" set "toolsets_vs16=" set "toolsets_vs17=" +set "toolsets_vs18=" for /f "usebackq tokens=*" %%I in (`vswhere.exe -latest -find "VC\Tools\MSVC"`) do set "MSVCDIR=%%I" @@ -30,8 +31,10 @@ for /f "delims=" %%D in ('dir /b /ad "%MSVCDIR%"') do ( set "toolsets_vc15=%%D" ) else if !min! LEQ 29 ( set "toolsets_vs16=%%D" - ) else ( + ) else if !min! LEQ 49 ( set "toolsets_vs17=%%D" + ) else ( + set "toolsets_vs18=%%D" ) ) ) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 4905dcb9ccbc..af25523805da 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -941,12 +941,12 @@ jobs: fail-fast: false matrix: ${{ fromJson(inputs.branch).jobs.WINDOWS.matrix }} name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || ''}}${{ matrix.clang && '_CLANG' || ''}}" - runs-on: windows-2022 + runs-on: ${{ fromJson(inputs.branch).jobs.WINDOWS.config.runs_on }} env: PHP_BUILD_CACHE_BASE_DIR: C:\build-cache PHP_BUILD_OBJ_DIR: C:\obj PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk - PHP_BUILD_SDK_BRANCH: php-sdk-2.5.0 + PHP_BUILD_SDK_BRANCH: php-sdk-2.7.1 PHP_BUILD_CRT: ${{ fromJson(inputs.branch).jobs.WINDOWS.config.vs_crt_version }} PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }} THREAD_SAFE: "${{ matrix.zts && '1' || '0' }}" diff --git a/ext/com_dotnet/tests/variants.phpt b/ext/com_dotnet/tests/variants.phpt index 8547e65efb33..a145fec87ae2 100644 --- a/ext/com_dotnet/tests/variants.phpt +++ b/ext/com_dotnet/tests/variants.phpt @@ -43,7 +43,7 @@ foreach ($values as $t => $val) { echo "OK!"; ?> ---EXPECT-- +--EXPECTF-- -- add: 84 cat: 4242 @@ -142,8 +142,8 @@ mul: 0 and: 0 div: variant_div(42, ) - exception Division by zero - code 80020012 + exception %s + code 800200%x eqv: -43 idiv: @@ -258,8 +258,8 @@ mul: 0 and: 0 div: variant_div(3.5, ) - exception Division by zero - code 80020012 + exception %s + code 800200%x eqv: -5 idiv: diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 4eece3795732..1379e9778ea1 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -3101,8 +3101,8 @@ function toolset_get_compiler_name(short) version = probe_binary(PHP_CL).substr(0, 5).replace('.', ''); - if (version >= 1940) { - return name; + if (version >= 1950) { + name = short ? "VS18" : "Visual C++ 2026"; } else if (version >= 1930) { name = short ? "VS17" : "Visual C++ 2022"; } else if (version >= 1920) { From 38e0aca422c28e756d74e53215b7bd9139598e42 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 18 May 2026 12:14:43 +0100 Subject: [PATCH 3/3] Fix GH-22071: JIT assertion on abstract static method call. The optimizer's ZEND_INIT_STATIC_METHOD_CALL handling returned the function entry even when the resolved method was abstract, leading the JIT to assert on a null address in jit_CONST_FUNC_PROTO when emitting a direct call (e.g. UnitEnum::cases()). close GH-22082 --- NEWS | 4 ++++ Zend/Optimizer/zend_optimizer.c | 2 +- ext/opcache/tests/gh22071.phpt | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 ext/opcache/tests/gh22071.phpt diff --git a/NEWS b/NEWS index ace3e868e659..c4682385ac10 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,10 @@ PHP NEWS - CLI: . Fixed bug GH-21901 (Stale getopt() optional value). (onthebed) +- Core: + . Fixed bug GH-22071 (JIT assertion on abstract static method call). + (David Carlier) + - Date: . Fixed bug GH-18422 (int overflow in php_date_llabs). (iliaal) diff --git a/Zend/Optimizer/zend_optimizer.c b/Zend/Optimizer/zend_optimizer.c index d3a43617e92c..b5de66331460 100644 --- a/Zend/Optimizer/zend_optimizer.c +++ b/Zend/Optimizer/zend_optimizer.c @@ -945,7 +945,7 @@ zend_function *zend_optimizer_get_called_func( if (ce) { zend_string *func_name = Z_STR_P(CRT_CONSTANT(opline->op2) + 1); zend_function *fbc = zend_hash_find_ptr(&ce->function_table, func_name); - if (fbc) { + if (fbc && !(fbc->common.fn_flags & ZEND_ACC_ABSTRACT)) { bool is_public = (fbc->common.fn_flags & ZEND_ACC_PUBLIC) != 0; bool same_scope = fbc->common.scope == op_array->scope; if (is_public || same_scope) { diff --git a/ext/opcache/tests/gh22071.phpt b/ext/opcache/tests/gh22071.phpt new file mode 100644 index 000000000000..148ca461be21 --- /dev/null +++ b/ext/opcache/tests/gh22071.phpt @@ -0,0 +1,20 @@ +--TEST-- +GH-22071: Assertion failure jit_CONST_FUNC_PROTO on abstract static method call +--CREDITS-- +YuanchengJiang +--EXTENSIONS-- +opcache +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=1205 +opcache.jit_buffer_size=16M +--FILE-- + +--EXPECT-- +ok