schmittjoh / serializer

Library for (de-)serializing data of any complexity (supports JSON, and XML)
http://jmsyst.com/libs/serializer
MIT License
2.32k stars 585 forks source link

The serialiser doesn't work since version 3.16.0 #1437

Closed CJDennis closed 2 years ago

CJDennis commented 2 years ago
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no

1366 added the following lines to src/Metadata/ClassMetadata.php:

            $this->discriminatorGroups,
            $this->xmlDiscriminatorAttribute,
            $this->xmlDiscriminatorCData,
            $this->usingExpression,
            $this->xmlDiscriminatorNamespace,
            $this->xmlRootPrefix,
            $this->isList,
            $this->isMap,

I now get [PHPUnit\Framework\Error\Warning] Undefined array key 16 at vendor\jms\serializer\src\Metadata\ClassMetadata.php:322 when running tests since $this->discriminatorGroups (which is already included two lines above) does not exist in the array.

Steps required to reproduce the problem

  1. Use any version from 3.16.0 to 3.18.2
  2. Serialise some data

Expected Result

Actual Result

goetas commented 2 years ago

please clear the cache

eloirobe commented 2 years ago

I've cleared the cache, both using the command clear:cache and deleting it completely by removing the whole folder, and it still doesn't work. I did some checks and I believe it crashes in JMS\Serializer\Metadata\ClassMetadata.php, method unserializeFromArray. When we check the values inside the param $data, we see the current values:

image

scyzoryck commented 2 years ago

Hi! Are you using JMSSerializerBundle ? What is yours cache configuration?

eloirobe commented 2 years ago

Yes we're using JMSSerializerBundle This is the Cache config with memcached also we clear memcached and not work:

framework:
    cache:
        default_memcached_provider: "%memcached.parameters%"
        pools:
            doctrine.result_cache_pool:
                adapter: cache.adapter.memcached
            doctrine.system_cache_pool:
                adapter: cache.adapter.memcached
            doctrine.second_level_cache_pool:
                adapter: cache.adapter.memcached
            doctrine.main_cache_region_pool:
                adapter: cache.adapter.memcached
eloirobe commented 2 years ago

Now it works We upgrade the JMSSerializerBundle from 3.9.x to version 4.0.x and it works. Is it possible that JMSSerializerBundle doesn't had well configure the require version of JMSSerializer in version 3.9.x?

goetas commented 2 years ago

Please make sure to clean the cache (whatever cache you might be using, files, redis, apc...)