Skip to content

Commit 545e34b

Browse files
committed
2 parents 16cca32 + c843be0 commit 545e34b

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

php_memcached.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static PHP_METHOD(Memcached, __construct)
406406
zend_fcall_info fci = {0};
407407
zend_fcall_info_cache fci_cache;
408408

409-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!f!S", &persistent_id, &fci, &fci_cache, &conn_str) == FAILURE) {
409+
if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|S!f!S", &persistent_id, &fci, &fci_cache, &conn_str) == FAILURE) {
410410
return;
411411
}
412412

@@ -1297,14 +1297,8 @@ static void php_memc_setMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke
12971297
retry:
12981298
if (!by_key) {
12991299
status = memcached_set(m_obj->memc, str_key->val, str_key->len, payload, payload_len, expiration, flags);
1300-
if (!skey) {
1301-
zend_string_release(str_key);
1302-
}
13031300
} else {
13041301
status = memcached_set_by_key(m_obj->memc, server_key->val, server_key->len, str_key->val, str_key->len, payload, payload_len, expiration, flags);
1305-
if (!skey) {
1306-
zend_string_release(str_key);
1307-
}
13081302
}
13091303

13101304
if (php_memc_handle_error(i_obj, status) < 0) {
@@ -2758,11 +2752,9 @@ static PHP_METHOD(Memcached, getResultMessage)
27582752
case MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE:
27592753
case MEMCACHED_UNKNOWN_READ_FAILURE:
27602754
if (i_obj->memc_errno) {
2761-
char *str;
2762-
int str_len;
2763-
str_len = spprintf(&str, 0, "%s: %s", memcached_strerror(m_obj->memc, (memcached_return)i_obj->rescode),
2764-
strerror(i_obj->memc_errno));
2765-
RETURN_STRINGL(str, str_len);
2755+
zend_string *str = strpprintf(0, "%s: %s",
2756+
memcached_strerror(m_obj->memc, (memcached_return)i_obj->rescode), strerror(i_obj->memc_errno));
2757+
RETURN_STR(str);
27662758
}
27672759
/* Fall through */
27682760
default:
@@ -3126,7 +3118,7 @@ zend_bool s_serialize_value (enum memcached_serializer serializer, zval *value,
31263118
#ifdef HAVE_MEMCACHED_MSGPACK
31273119
case SERIALIZER_MSGPACK:
31283120
php_msgpack_serialize(buf, value);
3129-
if (!buf->c) {
3121+
if (!buf->s) {
31303122
php_error_docref(NULL, E_WARNING, "could not serialize value with msgpack");
31313123
return 0;
31323124
}

0 commit comments

Comments
 (0)