From be09985c870a72d93e53295897679f49c0f11a58 Mon Sep 17 00:00:00 2001 From: Petr Sumbera Date: Fri, 18 Jul 2025 17:29:02 +0200 Subject: [PATCH] Fix GH-19169: ZEND_STATIC_ASSERT for -std=c++17 needs to define ZEND_STATIC_ASSERT to appropriate C++ static_assert instead of the C version. --- NEWS | 4 ++++ Zend/zend_portability.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index cbd68f4ce74..cee68cfdd62 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 8.3.25 +- Core: + . Fixed GH-19169 build issue with C++17 and ZEND_STATIC_ASSERT macro. + (psumbera) + - Hash: . Fix crash on clone failure. (nielsdos) diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 67068797314..2308d6cdb30 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -761,7 +761,9 @@ extern "C++" { /** @deprecated */ #define ZEND_CGG_DIAGNOSTIC_IGNORED_END ZEND_DIAGNOSTIC_IGNORED_END -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */ +#if defined(__cplusplus) +# define ZEND_STATIC_ASSERT(c, m) static_assert((c), m) +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */ # define ZEND_STATIC_ASSERT(c, m) _Static_assert((c), m) #else # define ZEND_STATIC_ASSERT(c, m)