From fee13f07055f3c0495d1d6c8f12f2ac91541c766 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 4 Feb 2025 21:13:03 +0100 Subject: [PATCH 1/3] Fix GH-8038: DOM extension reflection version is incorrect It doesn't appear to be reasonable to pretend that nothing in the DOM API would have changed in the last 21 years, and it's also not that reasonable to pretend that we would thoroughly bump that version in the future. Thus we go with the common convention to use the `PHP_VERSION` for bundled extensions. --- ext/dom/php_dom.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index 1c21d8a64e1a9..77fffd53587a5 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -56,11 +56,8 @@ extern zend_module_entry dom_module_entry; #include "xpath_callbacks.h" #include "zend_exceptions.h" #include "dom_ce.h" -/* DOM API_VERSION, please bump it up, if you change anything in the API - therefore it's easier for the script-programmers to check, what's working how - Can be checked with phpversion("dom"); -*/ -#define DOM_API_VERSION "20031129" + +#define DOM_API_VERSION PHP_VERSION /* Define a custom type for iterating using an unused nodetype */ #define DOM_NODESET XML_XINCLUDE_START From b0bd20e0d5cc5fe2deede06f5df95a4aa47cc5fd Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 5 Feb 2025 00:10:28 +0100 Subject: [PATCH 2/3] Use ZEND_MODULE_API_NO instead of PHP_VERSION for BC --- ext/dom/php_dom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index 77fffd53587a5..0a888264f971c 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -57,7 +57,7 @@ extern zend_module_entry dom_module_entry; #include "zend_exceptions.h" #include "dom_ce.h" -#define DOM_API_VERSION PHP_VERSION +#define DOM_API_VERSION ZEND_MODULE_API_NO /* Define a custom type for iterating using an unused nodetype */ #define DOM_NODESET XML_XINCLUDE_START From e5e6a348ff97f4ff947044f902243f9672e87292 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 5 Feb 2025 00:37:56 +0100 Subject: [PATCH 3/3] need a string --- ext/dom/php_dom.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index 0a888264f971c..a5721c688d0da 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -57,7 +57,10 @@ extern zend_module_entry dom_module_entry; #include "zend_exceptions.h" #include "dom_ce.h" -#define DOM_API_VERSION ZEND_MODULE_API_NO +#define PHP_DOM_STRINGIFY(x) #x +#define PHP_DOM_TOSTRING(x) PHP_DOM_STRINGIFY(x) +#define DOM_API_VERSION PHP_DOM_TOSTRING(ZEND_MODULE_API_NO) + /* Define a custom type for iterating using an unused nodetype */ #define DOM_NODESET XML_XINCLUDE_START