Skip to content

Commit

Permalink
Merge pull request #195 from Jan-E/no-fast-add-function-php83
Browse files Browse the repository at this point in the history
fast_add_function removed in PHP 8.3, use add_function
  • Loading branch information
rtheunissen authored Jun 18, 2023
2 parents 5ff4bf0 + d6ad43e commit 23ddc08
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ do { \
/**
* Adds the given zval "val" to "sum".
*/
#if PHP_MAJOR_VERSION < 8 || PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION < 3
#define DS_ADD_TO_SUM(val, sum) \
do { \
if (Z_TYPE_P(val) == IS_LONG || Z_TYPE_P(val) == IS_DOUBLE) { \
Expand All @@ -95,6 +96,19 @@ do { \
fast_add_function(sum, sum, &_num); \
} \
} while (0)
#else
#define DS_ADD_TO_SUM(val, sum) \
do { \
if (Z_TYPE_P(val) == IS_LONG || Z_TYPE_P(val) == IS_DOUBLE) { \
add_function(sum, sum, val); \
} else { \
zval _num; \
ZVAL_COPY(&_num, val); \
convert_scalar_to_number(&_num); \
add_function(sum, sum, &_num); \
} \
} while (0)
#endif

/**
* Used to replace a buffer with a new one.
Expand Down

0 comments on commit 23ddc08

Please sign in to comment.