Skip to content

Commit 27ad33b

Browse files
committed
Fix serializers
1 parent 782077c commit 27ad33b

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

.travis/travis.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ function install_libmemcached() {
6767
}
6868

6969
function install_igbinary() {
70-
git clone https://github.com/igbinary/igbinary.git
71-
pushd igbinary
70+
git clone https://github.com/igbinary/igbinary7.git
71+
pushd igbinary7
7272
phpize
7373
./configure
7474
make
@@ -79,7 +79,7 @@ function install_igbinary() {
7979
function install_msgpack() {
8080
git clone https://github.com/msgpack/msgpack-php.git
8181
pushd msgpack-php
82-
git checkout php7
82+
git checkout php7
8383
phpize
8484
./configure
8585
make
@@ -152,9 +152,9 @@ function build_php_memcached() {
152152
sasl_flag="--enable-memcached-sasl"
153153
fi
154154

155-
# ./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag --enable-memcached-json --enable-memcached-msgpack --enable-memcached-igbinary
156-
./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag
157-
make
155+
# ./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag
156+
./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag --enable-memcached-json --enable-memcached-msgpack --enable-memcached-igbinary
157+
make
158158
make install
159159
popd
160160
}
@@ -184,7 +184,7 @@ function run_memcached_tests() {
184184
rm ./tests/expire.phpt
185185

186186
# Run normal tests
187-
php run-tests.php --show-diff -d extension=memcached.so -n ./tests/*.phpt
187+
php run-tests.php --show-diff -d extension=modules/memcached.so -d extension=msgpack.so -d extension=igbinary.so -n ./tests/*.phpt
188188
retval=$?
189189
popd
190190
return $retval;
@@ -236,10 +236,10 @@ case $ACTION in
236236
install_libmemcached
237237

238238
# Install igbinary extension
239-
# install_igbinary
239+
install_igbinary
240240

241241
# install msgpack
242-
# install_msgpack
242+
install_msgpack
243243

244244
install_memcached
245245
run_memcached

php_memcached.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3187,11 +3187,18 @@ zend_bool s_serialize_value (enum memcached_serializer serializer, zval *value,
31873187
*/
31883188
#ifdef HAVE_MEMCACHED_IGBINARY
31893189
case SERIALIZER_IGBINARY:
3190-
if (igbinary_serialize((uint8_t **) &(buf->s), &buf->s->len, value) != 0) {
3190+
{
3191+
uint8_t *buffer;
3192+
size_t buffer_len;
3193+
3194+
if (igbinary_serialize(&buffer, &buffer_len, value) != 0) {
31913195
php_error_docref(NULL, E_WARNING, "could not serialize value with igbinary");
31923196
return 0;
31933197
}
3198+
smart_str_appendl (buf, buffer, buffer_len);
3199+
efree(buffer);
31943200
MEMC_VAL_SET_TYPE(*flags, MEMC_VAL_IS_IGBINARY);
3201+
}
31953202
break;
31963203
#endif
31973204

@@ -3395,7 +3402,7 @@ zend_bool s_unserialize_value (memcached_st *memc, int val_type, zend_string *pa
33953402

33963403
case MEMC_VAL_IS_IGBINARY:
33973404
#ifdef HAVE_MEMCACHED_IGBINARY
3398-
if (igbinary_unserialize((uint8_t *) payload->val, payload->len, &value)) {
3405+
if (igbinary_unserialize((uint8_t *) payload->val, payload->len, return_value)) {
33993406
ZVAL_FALSE(return_value);
34003407
php_error_docref(NULL, E_WARNING, "could not unserialize value with igbinary");
34013408
return 0;

0 commit comments

Comments
 (0)