summaryrefslogtreecommitdiffstats
path: root/950b257a9376d4f83fd24a7afadeafaf31f8855a.patch
blob: efb6385a1b16da5f659ba9761e38d0631aad15c9 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
From 950b257a9376d4f83fd24a7afadeafaf31f8855a Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 18 Jul 2018 07:39:47 +0200
Subject: [PATCH] fix for 7.3.0alpha4

---
 src/php_pq_params.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/php_pq_params.c b/src/php_pq_params.c
index 6739b45..3c6b920 100644
--- a/src/php_pq_params.c
+++ b/src/php_pq_params.c
@@ -123,7 +123,7 @@ static int apply_to_param_from_array(zval *zparam, void *arg_ptr)
 	struct apply_to_param_from_array_arg subarg, *arg = arg_ptr;
 	char *tmp;
 	size_t len;
-	zend_string *str;
+	zend_string *str, *tmpstr;
 
 	if (arg->index++) {
 		smart_str_appendc(arg->buffer, arg->delim);
@@ -134,7 +134,7 @@ static int apply_to_param_from_array(zval *zparam, void *arg_ptr)
 
 		ZVAL_LONG(&ztype, arg->type);
 		zend_call_method_with_2_params(arg->zconv, NULL, NULL, "converttostring", &rv, zparam, &ztype);
-		str = zval_get_string(&rv);
+		tmpstr = zval_get_string(&rv);
 		zval_ptr_dtor(&rv);
 		goto append_string;
 
@@ -176,15 +176,20 @@ static int apply_to_param_from_array(zval *zparam, void *arg_ptr)
 			break;
 
 		case IS_OBJECT:
-			if ((str = object_param_to_string(arg->params, zparam, arg->type))) {
+			if ((tmpstr = object_param_to_string(arg->params, zparam, arg->type))) {
 				goto append_string;
 			}
 			/* no break */
 		default:
-			str = zval_get_string(zparam);
+			tmpstr = zval_get_string(zparam);
 
 			append_string:
-			str = php_addslashes(str, 1);
+#if PHP_VERSION_ID < 70300
+			str = php_addslashes(tmpstr, 1);
+#else
+			str = php_addslashes(tmpstr);
+			zend_string_release(tmpstr);
+#endif
 			smart_str_appendc(arg->buffer, '"');
 			smart_str_appendl(arg->buffer, str->val, str->len);
 			smart_str_appendc(arg->buffer, '"');