Skip to content

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

@pwtitle

Description

@pwtitle

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

  • Phalcon version: 5.8.0
  • PHP Version: 8.3.9

Metadata

Metadata

Assignees

Labels

5.0The issues we want to solve in the 5.0 releasebugA bug reportstatus: mediumMedium

Type

No fields configured for Bug.

Projects

Status
Implemented

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions