Skip to content

Segmentation fault when serializing anonymous class with Redis::set() #2837

@arshidkv12

Description

@arshidkv12

Description

Using an anonymous class object with PhpRedis causes a segmentation fault during the serialization flow.

The following code reproduces the issue:

<?php

$redis = new Redis();
$redis->connect('127.0.0.1', 6379);

$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);

$obj = new class() {};

$redis->set('payload', $obj);
$redis->get('payload');

Expected behavior

PhpRedis should throw a normal PHP exception/error similar to:

Serialization of 'class@anonymous' is not allowed

Actual behavior

PHP crashes with a segmentation fault.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions