summaryrefslogtreecommitdiffstats
path: root/memcached-pr3.patch
blob: 5e0e1944822c0549bc6e6f7ff0d615299576abb2 (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
From 5c49c02dfd0b12f46ba2909aaec31938c6e96728 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Wed, 2 Mar 2016 11:37:50 +0100
Subject: [PATCH] Fix build with igbinary

Using https://github.com/igbinary/igbinary7
---
 php_memcached.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/php_memcached.c b/php_memcached.c
index 9195bfc..09df000 100644
--- a/php_memcached.c
+++ b/php_memcached.c
@@ -3088,11 +3088,17 @@ zend_bool s_serialize_value (enum memcached_serializer serializer, zval *value,
 		*/
 #ifdef HAVE_MEMCACHED_IGBINARY
 		case SERIALIZER_IGBINARY:
-			if (igbinary_serialize((uint8_t **) &buf->c, &buf->len, value) != 0) {
+			{
+			char *s;
+			size_t l;
+			if (igbinary_serialize((uint8_t **) &s, &l, value) != 0) {
 				php_error_docref(NULL, E_WARNING, "could not serialize value with igbinary");
 				return 0;
 			}
+			smart_str_setl(buf, s, l);
+			efree(s);
 			MEMC_VAL_SET_TYPE(*flags, MEMC_VAL_IS_IGBINARY);
+			}
 			break;
 #endif
 
@@ -3306,7 +3312,7 @@ zend_bool s_unserialize_value (enum memcached_serializer serializer, int val_typ
 
 		case MEMC_VAL_IS_IGBINARY:
 #ifdef HAVE_MEMCACHED_IGBINARY
-			if (igbinary_unserialize((uint8_t *)payload, payload_len, &value)) {
+			if (igbinary_unserialize((const uint8_t *)payload, payload_len, value)) {
 				ZVAL_FALSE(value);
 				php_error_docref(NULL, E_WARNING, "could not unserialize value with igbinary");
 				return 0;