Repository navigation
fix(rar): keep the PHP Windows SDK WINVER for unrar os.hpp - #1263
Conversation
unrar/os.hpp unconditionally redefines WINVER/_WIN32_WINNT to Windows XP. The generated main/internal_functions.c includes it before urlmon.h, so the mixed SDK versions break urlmon.h parsing (C2059 around PARSEACTION) in every Windows spc-max build. Guard both defines so the values chosen by the PHP build are preserved.
|
StaticPHP Test Bot Detected: Extensions: |
|
The Linux ext-test failure is not related to the rar/WINVER fix. The build compiles and links rar successfully; it fails later in the CLI smoke test with: This comes from net-snmp 5.10 ( |
|
Are we not using the bundled version of rar? I'd be surprised if that's a bundled extension issue. |
|
It's not a php-src bundled extension, but static bundling puts the rar header into the php core. |
henderkes
left a comment
There was a problem hiding this comment.
damn, you're right, I could have sworn rar was bundled
Why
The
[v3] Build Self-Hosted PHP Binary (Windows)run #39647065053 has all fourspc-minjobs green and all fourspc-maxjobs red. There are two separate causes.1. rar / unrar redefines the Windows SDK version macros
The
spc-maxextension list includesrar;spc-mindoes not.unrar/os.hppunconditionally does:PHP's Windows build already defines both for the modern SDK (
/D WINVER=0x0602,main/config.w32.hfor_WIN32_WINNT). The generatedmain/internal_functions.cincludes the rar header and thereforeunrar/os.hpp; a later extension header includesurlmon.h. Mixing the old XP definitions with Windows SDK 10.0.26100 in one translation unit makesurlmon.hfail:This is the failure in 8.2-spc-max and 8.3-spc-max.
2. GitHub API download failures (separate, transient)
8.4-spc-max and 8.5-spc-max fail earlier, before compiling PHP:
(8.5-spc-max:
libyamlinstead oflibzip.) These are exit-75 download errors from the GitHub API, not the rar code path. Re-running may pass; if it persists, the artifact downloader/token/rate-limit path needs a separate fix.Changes
src/Package/Extension/rar.php: add amakeForWindowshook that wraps the twounrar/os.hppdefines in#ifndef, preserving theWINVER/_WIN32_WINNTvalues already selected by the PHP build. If neither is defined, unrar still falls back to its previous XP values.The patch only runs on Windows and is idempotent.
Validation
php -l src/Package/Extension/rar.phpcomposer analyse— no errorscomposer test— 468 tests pass (the local untrackedtests/StaticPHP/Package/ZipTest.phpwas excluded; it is unrelated and currently fails againstv3)need-testis set to run the extension matrix, which includes the Windowsrarjob.Scope
This is independent of #1260 (Unix Swoole/pgsql fixes); it only touches the Windows rar build.