mirror of
https://github.com/php-win-ext/phpredis.git
synced 2026-03-24 00:52:16 +01:00
Fix issue with interned igbinary strings.
Possibly related to ticket #145.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user