From 1888f721f145bbc24b539bcfaaec4907c7d0f3f6 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Thu, 25 Jul 2024 00:26:28 +0200 Subject: [PATCH] Fix GH-15094: php_random_default_engine() is not C++ conforming Using compound literals is conforming to C99 (and up), but not with any C++ standard. Since the code is in a public header, it might be used by C++ extensions. Unfortunately, we cannot even used designated initializers, because these are a C++20 feature, so we stick with classic C/C++ code. --- ext/random/php_random.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/random/php_random.h b/ext/random/php_random.h index e4aa32126671..4c6ce344f6e3 100644 --- a/ext/random/php_random.h +++ b/ext/random/php_random.h @@ -167,10 +167,10 @@ PHPAPI void *php_random_default_status(void); static inline php_random_algo_with_state php_random_default_engine(void) { - return (php_random_algo_with_state){ - .algo = php_random_default_algo(), - .state = php_random_default_status(), - }; + php_random_algo_with_state raws; + raws.algo = php_random_default_algo(); + raws.state = php_random_default_status(); + return raws; } PHPAPI zend_string *php_random_bin2hex_le(const void *ptr, const size_t len);