php / php/php-src

Don't use deprecated `GetVersionEx()`

Open
#17,557 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Category: Engine Feature OS: Windows Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

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:

https://github.com/php/php-src/blob/10ccb6bf0d4593e7250ac699addf31deee82caa0/main/main.stub.php#L193-L232

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the Windows-specific code that populates EG(windows_version_info) and the GetVersion() call used by php_get_uname(), then compare them with the constants declared in main/main.stub.php. Determine whether the relevant OSVERSIONINFOEX fields can remain compatible without deprecated APIs, or whether affected userland constants need deprecation; done means the compatibility decision is documented and both deprecated calls are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
operating-systems
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.