facebook/hhvm — pull request #3318 by atdt (2014-07-30 19:47:56+00:00)
Title: Fixes for Redis extension and associated test suite

* Fix a couple of tests that were broken by 91b1918 adding two lines to the
wrong expect file (list.php.expect instead of info.php.expect).
* Fixed hphp/test/slow/ext_redis/watch.php.expect to expect the correct
behavior. (Tested by verifying with Zend + phpredis.)
* Make the key prefix set by the test suite include the md5 of the file path
plus UNIX timestamp representing the test suite initialization. This makes
the tests not break when the path exceeds the redis key length limit and it
makes repeated test runs not conflict with one another.
* Make Redis::sRandMember apply the key prefix (if one exists).
* Make Redis::get() and Redis::h{m}get() return false rather than null for
missing keys or fields, matching the behavior of phpredis.

Minimal test case for the false / null behavior:

connect("localhost");
var_dump($redis->get("nonexistent-key"));
$redis->hMset('ice_cream', array('flavor' => 'vanilla'));
var_dump($redis->hMget('ice_cream', array('flavor', 'nonexistent-field')));

Output with phpredis:

bool(false)
array(2) {
["flavor"]=>
string(7) "vanilla"
["nonexistent-field"]=>
bool(false)
}

Output with HHVM:

NULL
array(2) {
["flavor"]=>
string(7) "vanilla"
["nonexistent-field"]=>
NULL
}

Fixes https://bugzilla.wikimedia.org/show_bug.cgi?id=68841