Giter VIP home page Giter VIP logo

Comments (5)

marc-mabe avatar marc-mabe commented on August 29, 2024

mh please provide an example code that fails for you.
As the unserialize method should not be called on a cache miss undependable which serializer is in use (if any)

from zend-cache.

yuripave avatar yuripave commented on August 29, 2024

Example code running on latest master bc215ac with PHP 7.0.5.

<?php
require 'vendor/autoload.php';

$cache = \Zend\Cache\StorageFactory::adapterFactory('memcached', ['servers' => ['127.0.0.1']]);
$cache->addPlugin(\Zend\Cache\StorageFactory::pluginFactory('serializer', ['serializer' => 'json']));
$cache->getItem('cacheMiss');
$ php -v
PHP 7.0.5 (cli) (built: Apr  8 2016 12:16:01) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
$ php zend-cache#95.php
PHP Fatal error:  Uncaught Zend\Json\Exception\RuntimeException: Decoding failed: Syntax error in /path/to/zend-cache/vendor/zendframework/zend-json/src/Json.php:68
Stack trace:
#0 /path/to/zend-cache/vendor/zendframework/zend-serializer/src/Adapter/Json.php(89): Zend\Json\Json::decode('', 1)
#1 /path/to/zend-cache/src/Storage/Plugin/Serializer.php(72): Zend\Serializer\Adapter\Json->unserialize(NULL)
#2 /path/to/zend-cache/vendor/zendframework/zend-eventmanager/src/EventManager.php(271): Zend\Cache\Storage\Plugin\Serializer->onReadItemPost(Object(Zend\Cache\Storage\PostEvent))
#3 /path/to/zend-cache/vendor/zendframework/zend-eventmanager/src/EventManager.php(143): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Cache\Storage\PostEvent))
#4 /path/to/zend-cache/src/Storage/Adapter/AbstractAdapter.php(221): Zend\EventManager\EventManager->triggerEvent(Object(Zend\Cache\Storage\PostEvent))
#5 /path/to/zend-cache/src/Stora in /path/to/zend-cache/vendor/zendframework/zend-serializer/src/Adapter/Json.php on line 93

from zend-cache.

marc-mabe avatar marc-mabe commented on August 29, 2024

@yuripave The serializer plugin was trying to unserialize values of missing items (NULL). I thought that is not the case but it is and it's a bug of zend-cache. It just was not realized because the serializer was returning the input value untouched in this case (which in my opinion is also wrong)

Please try #96 if that works for you. Thanks!

from zend-cache.

yuripave avatar yuripave commented on August 29, 2024

Tested and works great, thanks!
Will this backport to 2.4 as well since it's LTS?

from zend-cache.

weierophinney avatar weierophinney commented on August 29, 2024

Will this backport to 2.4 as well since it's LTS?

No. We only backport security fixes, and fixes for issues that were regressions introduced by the 2.4 series itself.

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.