Code Monkey home page Code Monkey logo

Comments (7)

 avatar commented on June 14, 2024

hi @malinink

As you describe it looks like you the value gets serialized which has nothing to do with the variable by reference you linked.

Please provide a code example incl. how you setup the storage adapter and call to write/read with data as var_dump.

from zend-cache.

malinink avatar malinink commented on June 14, 2024

@DCMNMarc
I add test into MemcachedTest
All connection options are default (from phpunit.xml.dist)

    public function testMultipleKeySetIncrement()
    {
        $this->_storage->setItems(['key' => 0]);
        $value = $this->_storage->getItem('key');
        var_dump($value);
        $this->_storage->incrementItem('key', 1);
    }

That is test screen:

./vendor/bin/phpunit --filter testMultipleKeySetIncrement
PHPUnit 4.8.22 by Sebastian Bergmann and contributors.

Eint(0)


Time: 167 ms, Memory: 8.00Mb

There was 1 error:

1) ZendTest\Cache\Storage\Adapter\MemcachedTest::testMultipleKeySetIncrement
Zend\Cache\Exception\RuntimeException: CLIENT ERROR

zend-cache/src/Storage/Adapter/Memcached.php:700
zend-cache/src/Storage/Adapter/Memcached.php:578
zend-cache/src/Storage/Adapter/AbstractAdapter.php:1272
zend-cache/test/Storage/Adapter/MemcachedTest.php:206

FAILURES!
Tests: 1, Assertions: 2, Errors: 1.

It seems like adapter could get and set such kind of values but it store them as none integer values, so increment doesn't work.

That is real value stored in memcached

echo "get zfcache:key" | nc localhost 11211
VALUE zfcache:key 4 4
i:0;
END

Normally that value must be (and that happens in setItem() method)

echo "get zfcache:key" | nc localhost 11211
VALUE zfcache:key 1 1
0
END

That is error itself

echo "incr zfcache:key 1" | nc localhost 11211
CLIENT_ERROR cannot increment or decrement non-numeric value

from zend-cache.

marc-mabe avatar marc-mabe commented on June 14, 2024

@malinink Thanks for your help. I can reproduce the bug with Memcached and Apc and created a fix with #67
It's probably related the internal changes how PHP-7 handles variables by reference.

from zend-cache.

malinink avatar malinink commented on June 14, 2024

@marc-mabe
That PR completely fixes the issue. Thanks!

from zend-cache.

marc-mabe avatar marc-mabe commented on June 14, 2024

@malinink nice but the issue should be closed on merging that PR - thanks

from zend-cache.

marc-mabe avatar marc-mabe commented on June 14, 2024

link #74

@malinink I just noticed that currently there is no release (no stable, no beta, no alpha) for php memcached that supports PHP-7 (see #74) how did you install that?

from zend-cache.

malinink avatar malinink commented on June 14, 2024

@marc-mabe
I have installed php7.0-fpm package from that ppa https://launchpad.net/~ondrej/+archive/ubuntu/php
But as you can see there is no php7.0-memcached package present there.
I could install it as usual with php-memcached name.
I also install php-redis and other packages that are not prefixed with php7.0 (I could provide all list), and have not found any problems (So I decided that these packages are fully compatible).

That is one thing I don't think about.

from zend-cache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.