summaryrefslogtreecommitdiffstats
path: root/0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2023-07-12 09:34:53 +0200
committerRemi Collet <remi@php.net>2023-07-12 09:34:53 +0200
commitd1cbd173944bbba55b92de019b01760746a67f78 (patch)
tree093377c6d0c99feef13304e2715bd012763ce395 /0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch
parent9962481fc712894379c909cef442cbf917c148a2 (diff)
build out of sources tree
add upstream patch for PHP 8.3
Diffstat (limited to '0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch')
-rw-r--r--0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch b/0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch
new file mode 100644
index 0000000..56f2bd9
--- /dev/null
+++ b/0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch
@@ -0,0 +1,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
+