7 Commits

Author SHA1 Message Date
michael-grunder
2a4407f7d9 More IPv6 additions
* Modified RedisArray to support IPv6
* Updated general test suite to take an override host
* Updated make-cluster.sh to take an override host
2016-02-12 18:20:26 -08:00
michael-grunder
7b36957682 Various memory related fixes for php7
The php7 api has substantial changes in the way one goes about
interacting with the zval type (php's internal structure for dealing
with dynamically typed variables).

Most notably, most everything is dereferenced by one pointer.  So,
where you once used zval** you typically use zval*, and where you
used zval* you now just use a zval struct on the stack.

In addition, the api changed in how you return a string.  Previously
you had the option of whether or not to "duplicate" the memory returned
(or in other words, pass ownership of the pointer to PHP or not).

Because phpredis sometimes buffers commands to the server (say in the
case of a pipeline, or a MULTI/EXEC) transaction, we had several stack
violations and/or memory corruption which resulted from keeping track
of the address of a stack allocated structure, which was accessed at
a later date (sometimes causing segmentation faults, bus errors, etc).

Also, there were a few places where this pattern was being used:

zval **ptr = emalloc(sizeof(zval*) * count);
/* stuff */
ZVAL_STRING(ptr[0], "hello world");

Given that ZVAL_STRING() thinks it's writing to an allocated structure
it would cause various random issues (because we were blowing through
the data segment and writing into the code section).

This commit (so far) fixes all of the segmentation faults and memory
errors but there are still leaks (specifically in RedisArray) that need
to be solved.

Addresses #727
2016-01-25 12:55:41 -08:00
michael-grunder
7175aee5e2 Don't double define constant (rebase/merge fail) 2015-05-08 15:31:40 -07:00
michael-grunder
fb0597992a Merge remote 2015-05-07 16:30:11 -07:00
michael-grunder
08ecec92a3 Unit test suite improvements and cluster failover test
* Added a test specifically for RedisCluster to test slave failover
  settings.
* Added an option to specifically disable colorization, as well as
  a mechanism to determine if the output is being piped, such that
  we can turn colorization off in that case as well.
2015-05-05 15:18:02 -07:00
michael-grunder
97c9edc3aa Sorted a memory leak in RedisArray and retabbed unit tests 2015-05-05 15:18:01 -07:00
michael-grunder
79cb6a8905 Initial commit reworking unit tests
This commit reworks the unit tests such that all three classes
(Redis, RedisArray, and RedisCluster) can be tested using the
TestRedis.php script.

Now, when running TestRedis.php an option can be passed for which
part of phpredis we would like to test (defaults to Redis).
2015-05-05 15:07:43 -07:00