Skip to content

Fix GH-7815: Report Windows 11, Server 2019 and 2022 in php_uname #7816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions ext/standard/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,34 @@ char* php_get_windows_name()

if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion >= 10) {
if (osvi.dwMajorVersion == 10) {
if( osvi.dwMinorVersion == 0 ) {
if( osvi.wProductType == VER_NT_WORKSTATION ) {
major = "Windows 10";
if (osvi.dwMinorVersion == 0) {
if (osvi.wProductType == VER_NT_WORKSTATION) {
if (osvi.dwBuildNumber >= 22000) {
major = "Windows 11";
} else {
major = "Windows 10";
}
} else {
major = "Windows Server 2016";
if (osvi.dwBuildNumber >= 20348) {
major = "Windows Server 2022";
} else if (osvi.dwBuildNumber >= 19042) {
major = "Windows Server, version 20H2";
} else if (osvi.dwBuildNumber >= 19041) {
major = "Windows Server, version 2004";
} else if (osvi.dwBuildNumber >= 18363) {
major = "Windows Server, version 1909";
} else if (osvi.dwBuildNumber >= 18362) {
major = "Windows Server, version 1903";
} else if (osvi.dwBuildNumber >= 17763) {
// could also be Windows Server, version 1809, but there's no easy way to tell
major = "Windows Server 2019";
} else if (osvi.dwBuildNumber >= 17134) {
major = "Windows Server, version 1803";
} else if (osvi.dwBuildNumber >= 16299) {
major = "Windows Server, version 1709";
} else {
major = "Windows Server 2016";
}
}
}
}
Expand Down