1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-14 11:49:53 +03:00
aports/testing/php83-pecl-ds/fix-php83.patch
2023-10-14 17:16:28 +02:00

41 lines
1.8 KiB
Diff

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.