Repository navigation
fix(rar): undef PARSE_SERVER before unrar includes on Windows - #1268
Merged
Merged
Conversation
unrar os.hpp includes shlwapi.h, which includes objbase.h -> urlmon.h. urlmon.h declares a PARSEACTION enum member called PARSE_SERVER, but main/php_variables.h already defines PARSE_SERVER as 5. In the generated main/internal_functions.c this expands to "5 = (PARSE_MIME + 1)" and MSVC fails with C2059 at urlmon.h. Undefine PARSE_SERVER in php_rar.h before including unrar/os.hpp. The header is not used by the rar extension, so this is TU-local. The WINVER guard is kept (it silences the SDK macro redefinition warnings), but it was not the cause of the urlmon.h failure.
|
StaticPHP Test Bot Detected: Extensions: |
henderkes
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1263. The Windows
spc-maxjobs still fail aturlmon.hafter theWINVERguard, because the real collision is a macro name.Root cause
unrar/os.hppincludes<shlwapi.h>, and the Windows SDK chain is:urlmon.hdeclares:But
main/php_variables.halready defines:main/internal_functions.cincludesphp.hfirst and thenext/rar/php_rar.h(which includesunrar/os.hpp), so the enum member expands to5 = (PARSE_MIME + 1)and MSVC reports:The
WINVERguard from #1263 removes the C4005 warnings but does not fix this; the failure isPARSE_SERVER, notWINVER.Fix
In
php_rar.h,#undef PARSE_SERVERbefore#include "unrar/os.hpp". The rar extension does not use that macro, so the undef is TU-local.Validation
php -l,composer test(468),composer analyse,composer cs-fix: clean.rarext test will verify the MSVC build; cannot run MSVC locally (macOS host).