diff --git a/igbinary/igbinary.c b/igbinary/igbinary.c index 276aeee..33feeaa 100644 --- a/igbinary/igbinary.c +++ b/igbinary/igbinary.c @@ -454,7 +454,7 @@ inline static int igbinary_serialize_data_init(struct igbinary_serialize_data *i hash_si_init(&igsd->objects, 16); } - igsd->compact_strings = (bool)IGBINARY_G(compact_strings); + igsd->compact_strings = 1; // PHPHREDIS WARNING: DO NOT CHANGE. return r; } diff --git a/tests/TestRedis.php b/tests/TestRedis.php index b1803c1..a8dfa51 100644 --- a/tests/TestRedis.php +++ b/tests/TestRedis.php @@ -2810,6 +2810,13 @@ class Redis_Test extends TestSuite $this->assertTrue($data['data'] === 'test 1'); $this->assertTrue($data['session_id'] === 'test 2'); + // issue #145, serializer with objects. + $this->redis->set('x', array(new stdClass, new stdClass)); + $x = $this->redis->get('x'); + $this->assertTrue(is_array($x)); + $this->assertTrue(is_object($x[0]) && get_class($x[0]) === 'stdClass'); + $this->assertTrue(is_object($x[1]) && get_class($x[1]) === 'stdClass'); + // revert $this->assertTrue($this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE) === TRUE); // set ok $this->assertTrue($this->redis->getOption(Redis::OPT_SERIALIZER) === Redis::SERIALIZER_NONE); // get ok