Skip to content

Don't use deprecated GetVersionEx() #17557

Open
@cmb69

Description

@cmb69

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions