Skip to content
New issue

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

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

Already on GitHub? # to your account

Don't use deprecated GetVersionEx() #17557

Open
cmb69 opened this issue Jan 24, 2025 · 0 comments
Open

Don't use deprecated GetVersionEx() #17557

cmb69 opened this issue Jan 24, 2025 · 0 comments

Comments

@cmb69
Copy link
Member

cmb69 commented Jan 24, 2025

Description

We're using GetVersionEx() to set EG(windows_version_info), and also GetVersion() in php_get_uname() (the latter might reuse the former; I'll have a closer look). Both functions are deprecated, and the documentation states:

GetVersionExA may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions.

Using the version helper functions in combination with GetProductInfo() is indeed an option, but changing EG(windows_version_info) to no longer hold an OSVERSIONINFOEX structure would be a BC break, which is exacerbated by the fact that we make the fields available as userland constants:

php-src/main/main.stub.php

Lines 193 to 232 in 10ccb6b

/**
* @var int
* @cvalue EG(windows_version_info).dwMajorVersion
*/
const PHP_WINDOWS_VERSION_MAJOR = UNKNOWN;
/**
* @var int
* @cvalue EG(windows_version_info).dwMinorVersion
*/
const PHP_WINDOWS_VERSION_MINOR = UNKNOWN;
/**
* @var int
* @cvalue EG(windows_version_info).dwBuildNumber
*/
const PHP_WINDOWS_VERSION_BUILD = UNKNOWN;
/**
* @var int
* @cvalue EG(windows_version_info).dwPlatformId
*/
const PHP_WINDOWS_VERSION_PLATFORM = UNKNOWN;
/**
* @var int
* @cvalue EG(windows_version_info).wServicePackMajor
*/
const PHP_WINDOWS_VERSION_SP_MAJOR = UNKNOWN;
/**
* @var int
* @cvalue EG(windows_version_info).wServicePackMinor
*/
const PHP_WINDOWS_VERSION_SP_MINOR = UNKNOWN;
/**
* @var int
* @cvalue EG(windows_version_info).wSuiteMask
*/
const PHP_WINDOWS_VERSION_SUITEMASK = UNKNOWN;
/**
* @var int
* @cvalue EG(windows_version_info).wProductType
*/
const PHP_WINDOWS_VERSION_PRODUCTTYPE = UNKNOWN;

Either we find a way to populate the (relevant) fields of OSVERSIONINFOEX without calling any deprecated functions, or we may consider to deprecate some of the userland constants. Maybe we should do both.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant