Skip to content

Commit

Permalink
Remove "failed to set key" warning from setMulti (#490)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Krinkle authored Aug 23, 2021
1 parent 605a8a6 commit 6d45715
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions php_memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -1907,9 +1907,8 @@ static void php_memc_setMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke
str_key = zend_string_init(tmp_key, tmp_len, 0);
}

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

if (!skey) {
zend_string_release (str_key);
Expand Down
1 change: 0 additions & 1 deletion tests/experimental/setmulti_badserialize.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,5 @@ try {
var_dump($m->getByKey('kef', 'foo'));

--EXPECT--
Memcached::setMultiByKey(): failed to set key foo
1234
int(10)

0 comments on commit 6d45715

Please sign in to comment.