Php memcached error

Every time I try to use the add () function for memcached, I get the following error:

A PHP Error was encountered

Severity: Warning

Message: MemcachePool::add(): The lowest two bytes of the flags array is reserved for pecl/memcache internal use

Filename: libraries/memcached_library.php

Line Number: 92

What could be wrong? I use this library for codeigniter: http://github.com/trs21219/memcached-library

+3
source share
4 answers

Are you on 64 bits? This looks like a recently discovered bug with pecl / memcache: http://pecl.php.net/bugs/bug.php?id=18567

This seems to be related to the compression flag. It can no longer be logical, it must be an integer according to this source code

/**
 * The compressed argument on Memcache::add, Memcache::set and Memcache::replace takes
 * an integer not a boolean. Since pecl/memcache 3.0.3 booleans now leads to warnings like
 * The lowest two bytes of the flags array is reserved for pecl/memcache internal use
 */
+13
source

, : memcache, http://www.codeforest.net/how-to-install-memcached-on-windows-machine, :

$memcache->add("key", $tmp, 30);

expiration seconds (30 ):

$memcache->add("key", $tmp, MEMCACHE_COMPRESSED, 30);

$memcache->add("key", $tmp, false, 30);

: http://zurmo.org/wiki/installing-memcache-on-windows
. http://php.net/manual/ru/memcache.add.php

.

+6

'false' , .

Warning (2): MemcachePool::add() [memcachepool.add]: The lowest two bytes of the flags array is reserved for pecl/memcache internal use

From:
return $this->memcache->add($name, $value, $expiry);

To:
return $this->memcache->add($name, $value, false, $expiry);
+5

, codeigniter, memcache, memcached . : https://github.com/pierskarsenbarg/codeigniter-session-memcached

, lib

memcache->set()

/

memcache->replace()

the third parameter was the expiration time, not the valid flag type.

i.e. MEMCACHE_COMPRESSED

Example

Original code:

$this->memcache->set('user_session_data' . $this->userdata['session_id'], $this->userdata, $this->sess_expiration); 

Modified Code:

$this->memcache->set('user_session_data' . $this->userdata['session_id'], $this->userdata, MEMCACHE_COMPRESSED, $this->sess_expiration);

After changing the third parameter to the correct flag type, the error disappeared.

+1
source

Source: https://habr.com/ru/post/1765393/


All Articles