Skip to content

Commit 23ddc08

Browse files
authored
Merge pull request #195 from Jan-E/no-fast-add-function-php83
fast_add_function removed in PHP 8.3, use add_function
2 parents 5ff4bf0 + d6ad43e commit 23ddc08

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/common.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ do { \
8484
/**
8585
* Adds the given zval "val" to "sum".
8686
*/
87+
#if PHP_MAJOR_VERSION < 8 || PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION < 3
8788
#define DS_ADD_TO_SUM(val, sum) \
8889
do { \
8990
if (Z_TYPE_P(val) == IS_LONG || Z_TYPE_P(val) == IS_DOUBLE) { \
@@ -95,6 +96,19 @@ do { \
9596
fast_add_function(sum, sum, &_num); \
9697
} \
9798
} while (0)
99+
#else
100+
#define DS_ADD_TO_SUM(val, sum) \
101+
do { \
102+
if (Z_TYPE_P(val) == IS_LONG || Z_TYPE_P(val) == IS_DOUBLE) { \
103+
add_function(sum, sum, val); \
104+
} else { \
105+
zval _num; \
106+
ZVAL_COPY(&_num, val); \
107+
convert_scalar_to_number(&_num); \
108+
add_function(sum, sum, &_num); \
109+
} \
110+
} while (0)
111+
#endif
98112

99113
/**
100114
* Used to replace a buffer with a new one.

0 commit comments

Comments
 (0)