1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
From d6ad43ee713b4b57111462309358c97e0b43cab3 Mon Sep 17 00:00:00 2001
From: Jan Ehrhardt <github@ehrhardt.nl>
Date: Sun, 18 Jun 2023 01:48:54 +0200
Subject: [PATCH] fast_add_function removed in PHP 8.3, use add_function
---
src/common.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/common.h b/src/common.h
index 5ff8cd4..509a6bb 100644
--- a/src/common.h
+++ b/src/common.h
@@ -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) { \
@@ -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.
--
2.41.0
|