phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.79k stars 1.96k forks source link

[BUG]: phalcon/Storage/Serializer/Json.zep can't serialize stdClass #16630

Open pwtitle opened 3 months ago

pwtitle commented 3 months ago

phalcon/Storage/Serializer/Json.zep can't serialize stdClass

        $serializerFactory = new \Phalcon\Storage\SerializerFactory();
        $adapterFactory    = new \Phalcon\Cache\AdapterFactory($serializerFactory);

        $adapter = $adapterFactory->newInstance('redis', [
            'defaultSerializer' => 'Json',
            "host"              => "***",
            'lifetime'          => 7200,
            "auth"              => "****",
        ]);
        $cache = new \Phalcon\Cache\Cache($adapter);

        $who = new \stdClass();
        $who->name = "testName";

        $cache->set("test", $who);  // this line get error: Data for the JSON serializer cannot be of type 'object' without implementing 'JsonSerializable'

Screenshots 123

Details