Fix issue with interned igbinary strings.

Possibly related to ticket #145.
This commit is contained in:
Nicolas Favre-Felix
2012-03-15 00:04:48 +00:00
parent ae147cfaed
commit 199d5e696f
2 changed files with 8 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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