Skip to content

Commit 6d45715

Browse files
authored
Remove "failed to set key" warning from setMulti (#490)
This was introduced in 6837d89494, pull #214. I suspect it may have been a left-over from debugging something. The test was later changed in 6837d89 to expect the warning in question, although other similar tests don't encounter such warning currently. It appears no other Memcached methods emit a PHP Warning when they encounter a write read or failure. Instead, they typically turn their return value into boolean false, and provide details via getResultMessage(). The introduction of this warning since php-memcached 3.0 has led to a number of confused consumers (locally #260, #409, #450, and more reports within downstream issue trackers). Closes #409.
1 parent 605a8a6 commit 6d45715

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Diff for: php_memcached.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -1907,9 +1907,8 @@ static void php_memc_setMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke
19071907
str_key = zend_string_init(tmp_key, tmp_len, 0);
19081908
}
19091909

1910-
if (!s_memc_write_zval (intern, MEMC_OP_SET, server_key, str_key, value, expiration)) {
1911-
php_error_docref(NULL, E_WARNING, "failed to set key %s", ZSTR_VAL(str_key));
1912-
}
1910+
/* If this failed to write a value, intern stores the error for the return value */
1911+
s_memc_write_zval (intern, MEMC_OP_SET, server_key, str_key, value, expiration);
19131912

19141913
if (!skey) {
19151914
zend_string_release (str_key);

Diff for: tests/experimental/setmulti_badserialize.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,5 @@ try {
4242
var_dump($m->getByKey('kef', 'foo'));
4343

4444
--EXPECT--
45-
Memcached::setMultiByKey(): failed to set key foo
4645
1234
4746
int(10)

0 commit comments

Comments
 (0)