summaryrefslogtreecommitdiff
path: root/src/sp_php_compat.c
diff options
context:
space:
mode:
authorjvoisin2022-03-20 18:20:45 +0100
committerjvoisin2022-03-20 18:20:45 +0100
commit81dd7f2ef07af306fe83d7755cbac4529aa9fc8d (patch)
tree32cc44c6231b30db5ac7b15699297863460784aa /src/sp_php_compat.c
parent83b01942dfc80474cc05e09aeef4b44307a7120b (diff)
parentc38df1077a6c1dfbca1baca049214d053e2e7684 (diff)
Merge remote-tracking branch 'sektioneins/master'
Diffstat (limited to 'src/sp_php_compat.c')
-rw-r--r--src/sp_php_compat.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sp_php_compat.c b/src/sp_php_compat.c
new file mode 100644
index 0000000..a0693c3
--- /dev/null
+++ b/src/sp_php_compat.c
@@ -0,0 +1,25 @@
1#include "php_snuffleupagus.h"
2
3/* code in this file is licensed under its original license
4 The PHP License, version 3.01 (https://www.php.net/license/3_01.txt)
5 which is also included with these sources in the file `PHP_LICENSE` */
6
7#if PHP_VERSION_ID < 80000
8
9// copied from PHP 8.0.9 sources
10
11ZEND_API zend_string *zend_string_concat2(
12 const char *str1, size_t str1_len,
13 const char *str2, size_t str2_len)
14{
15 size_t len = str1_len + str2_len;
16 zend_string *res = zend_string_alloc(len, 0);
17
18 memcpy(ZSTR_VAL(res), str1, str1_len);
19 memcpy(ZSTR_VAL(res) + str1_len, str2, str2_len);
20 ZSTR_VAL(res)[len] = '\0';
21
22 return res;
23}
24
25#endif