From a74eb24e699c86d69ba506fa54a7901bec9ae530 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sat, 5 Oct 2024 15:16:49 +0200 Subject: [PATCH] Unify types of PHP_VERSION and friends on Windows For `phpize` builds, all three version variables are numbers, but for `buildconf` builds, all are strings. This can yield surprising results when extensions create their `PHP_VERSION_ID` like 10000 * PHP_VERSION + 100 * PHP_MINOR_VERSION + PHP_RELEASE_VERSION Since `phpize` builds are way more common for external extensions nowadays, we change the types for `buildconf` builds. Closes GH-16247. --- UPGRADING | 4 ++++ win32/build/confutils.js | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/UPGRADING b/UPGRADING index 94e080b381a..685dfec30c4 100644 --- a/UPGRADING +++ b/UPGRADING @@ -102,6 +102,10 @@ PHP 8.5 UPGRADE NOTES 12. Windows Support ======================================== +* The configuration variables PHP_VERSION, PHP_MINOR_VERSION, and + PHP_RELEASE_VERSION are now always numbers. Previously, they have been + strings for buildconf builds. + ======================================== 13. Other Changes ======================================== diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 438956cbb60..479ce06ad50 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -108,9 +108,9 @@ function get_version_numbers() var regex = /AC_INIT.+(\d+)\.(\d+)\.(\d+)([^\,^\]]*).+/g; if (cin.match(new RegExp(regex))) { - PHP_VERSION = RegExp.$1; - PHP_MINOR_VERSION = RegExp.$2; - PHP_RELEASE_VERSION = RegExp.$3; + PHP_VERSION = +RegExp.$1; + PHP_MINOR_VERSION = +RegExp.$2; + PHP_RELEASE_VERSION = +RegExp.$3; PHP_EXTRA_VERSION = RegExp.$4; }