/home/lnzliplg/public_html/alt-php81-phpiredis_1.0.1-1.el8.zip
PK���\a�����testsuite_skipif.incnu�[���<?php

require_once 'testsuite_configuration.inc';

if (!extension_loaded("phpiredis")) {
    die("skip phpiredis extension is not available");
}
PK���\%7�4��reader_010.phptnu�[���--TEST--
[READER] Keep multibulk responses types

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
$reader = phpiredis_reader_create();

$buffer = "*3\r\n:1\r\n+OK\r\n*2\r\n$3\r\nASD\r\n$-1\r\n";
phpiredis_reader_feed($reader, $buffer);
var_dump(phpiredis_reader_get_reply($reader));

--EXPECT--
array(3) {
  [0]=>
  int(1)
  [1]=>
  string(2) "OK"
  [2]=>
  array(2) {
    [0]=>
    string(3) "ASD"
    [1]=>
    NULL
  }
}
PK���\C���testsuite_utilities.incnu�[���<?php

require_once 'testsuite_configuration.inc';

if (!function_exists('create_phpiredis_connection')) {
    function create_phpiredis_connection($host, $port = 6379, $persistent = false) {
        global $connect_flags;

        if ($persistent) {
            $link = phpiredis_pconnect($host, $port);
        } else {
            $link = phpiredis_connect($host, $port);
        }

        if (!$link) {
            printf("Cannot connect to host '%s' on port [%d]\n", $host, $port);

            return false;
        }

        return $link;
    }
} else {
    printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n");
}
PK���\rUXZreader_001.phptnu�[���--TEST--
[READER] Create reader resource

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
$reader = phpiredis_reader_create();
var_dump($reader);

phpiredis_reader_destroy($reader);


--EXPECTF--
resource(%d) of type (phpredis reader)
PK���\��tzzclient_005.phptnu�[���--TEST--
[CLIENT] Execute pipelined commands
--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';
?>
--FILE--
<?php
require_once 'testsuite_utilities.inc';

$redis = create_phpiredis_connection(REDIS_HOST, REDIS_PORT);

$commands = phpiredis_multi_command($redis, array(
    'DEL test',
    'SET test 1',
    'GET test'
));

var_dump($commands[2]);
?>
--EXPECT--
string(1) "1"
PK���\V�:Y��client_008.phptnu�[���--TEST--
[CLIENT] Execute commands with binary data (binary-safe)

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

if (!@is_readable('/dev/urandom')) {
    die('skip Cannot read from /dev/urandom"');
}

--FILE--
<?php
require_once 'testsuite_utilities.inc';

$redis = create_phpiredis_connection(REDIS_HOST, REDIS_PORT);

$resource = fopen('/dev/urandom', 'r');
$data = fread($resource, 1024);
fclose($resource);

phpiredis_command_bs($redis, array('DEL', 'test'));
phpiredis_command_bs($redis, array('SET', 'test', $data));
$response = phpiredis_command_bs($redis, array('GET', 'test'));

var_dump($response === $data);

--EXPECT--
bool(true)
PK���\��ƻ��serializer_001.phptnu�[���--TEST--
[SERIALIZER] Command serialization

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
$response = phpiredis_format_command(array('a', 's', 'd'));
var_dump($response);

--EXPECT--
string(25) "*3
$1
a
$1
s
$1
d
"
PK���\��G88reader_005.phptnu�[���--TEST--
[READER] Response types

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php

$type = -1;
$reader = phpiredis_reader_create();

phpiredis_reader_feed($reader, "+OK\r\n");
$reply = phpiredis_reader_get_reply($reader, $type);
if ($reply != 'OK') {
    echo "Value of reply '$reply' is not 'OK'\n";
}
if ($type != PHPIREDIS_REPLY_STATUS) {
    echo "Value of type '$type' != PHPIREDIS_REPLY_STATUS(".PHPIREDIS_REPLY_STATUS.")\n";
}

$reader = phpiredis_reader_create();
phpiredis_reader_feed($reader, "-ERR\r\n");
$reply = phpiredis_reader_get_reply($reader, $type);
if ($reply != 'ERR') {
    echo "Value of reply '$reply' is not 'ERR'\n";
}
if ($type != PHPIREDIS_REPLY_ERROR) {
    echo "Value of type '$type' != PHPIREDIS_REPLY_ERROR(".PHPIREDIS_REPLY_ERROR.")\n";
}
echo "OK\n";

--EXPECT--
OK

PK���\�6i?��client_007.phptnu�[���--TEST--
[CLIENT] Execute commands (binary-safe)

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
require_once 'testsuite_utilities.inc';

$redis = create_phpiredis_connection(REDIS_HOST, REDIS_PORT);

phpiredis_command_bs($redis, array('DEL', 'test'));
phpiredis_command_bs($redis, array('SET', 'test', '1'));
$response = phpiredis_command_bs($redis, array('GET', 'test'));

var_dump($response);

--EXPECT--
string(1) "1"
PK���\��a��reader_013.phptnu�[���--TEST--
[READER] Parameters formatting should not break on many arguments

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
$array = array('MSET', 'key1', '1', 'key2', '2', 'key3', '3', 'key4', '4', 'key5', '5');

var_dump(phpiredis_format_command($array));
var_dump($array);

--EXPECT--
string(100) "*11
$4
MSET
$4
key1
$1
1
$4
key2
$1
2
$4
key3
$1
3
$4
key4
$1
4
$4
key5
$1
5
"
array(11) {
  [0]=>
  string(4) "MSET"
  [1]=>
  string(4) "key1"
  [2]=>
  string(1) "1"
  [3]=>
  string(4) "key2"
  [4]=>
  string(1) "2"
  [5]=>
  string(4) "key3"
  [6]=>
  string(1) "3"
  [7]=>
  string(4) "key4"
  [8]=>
  string(1) "4"
  [9]=>
  string(4) "key5"
  [10]=>
  string(1) "5"
}
PK���\_���reader_007.phptnu�[���--TEST--
[READER] Set custom status handler

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php

function status_handler($payload) {
    return "CUSTOM $payload";
}

$reader = phpiredis_reader_create();

phpiredis_reader_feed($reader, "+OK\r\n");
var_dump(phpiredis_reader_get_reply($reader) === 'OK');

phpiredis_reader_set_status_handler($reader, 'status_handler');
phpiredis_reader_feed($reader, "+OK\r\n");
var_dump(phpiredis_reader_get_reply($reader) === 'CUSTOM OK');
var_dump(FALSE === @phpiredis_reader_set_status_handler($reader, 'fake_status_handler'));

phpiredis_reader_feed($reader, "+PONG\r\n");
var_dump(phpiredis_reader_get_reply($reader) === 'CUSTOM PONG');

var_dump(TRUE === phpiredis_reader_set_status_handler($reader, NULL));
phpiredis_reader_feed($reader, "+QUEUED\r\n");
var_dump(phpiredis_reader_get_reply($reader) === 'QUEUED');

--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
PK���\j�Q�client_006.phptnu�[���--TEST--
[CLIENT] Execute pipelined commands returning nested multibulk responses

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
require_once 'testsuite_utilities.inc';

$redis = create_phpiredis_connection(REDIS_HOST, REDIS_PORT);

$commands = phpiredis_multi_command($redis, array(
    'DEL test',
    'LPUSH test 1',
    'LPUSH test 2',
    'LPUSH test 3',
    'LRANGE test 0 -1',
));

var_dump($commands[4]);

--EXPECT--
array(3) {
  [0]=>
  string(1) "3"
  [1]=>
  string(1) "2"
  [2]=>
  string(1) "1"
}
PK���\
�6��client_010.phptnu�[���--TEST--
[CLIENT] Do not attempt to reconnect upon disconnection

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
require_once 'testsuite_utilities.inc';

$redis = create_phpiredis_connection(REDIS_HOST, REDIS_PORT);

phpiredis_command($redis, 'SET a 1');

var_dump(phpiredis_command($redis, 'GET a'));
var_dump(phpiredis_command($redis, 'QUIT'));
var_dump(phpiredis_command($redis, 'GET a'));

--EXPECT--
string(1) "1"
string(2) "OK"
bool(false)
PK���\iY�|reader_004.phptnu�[���--TEST--
[READER] Reset reader

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php

$reader = phpiredis_reader_create();

phpiredis_reader_feed($reader, "+OK\r\n");
phpiredis_reader_reset($reader);

phpiredis_reader_feed($reader, "$3\r\nSET\r\n");
var_dump(phpiredis_reader_get_reply($reader) === 'SET');
phpiredis_reader_feed($reader, "OK\r\n");
phpiredis_reader_reset($reader);

phpiredis_reader_feed($reader, "$3\r\nSET\r\n");
var_dump(phpiredis_reader_get_reply($reader) === 'SET');

--EXPECT--
bool(true)
bool(true)
PK���\ȳ�\reader_009.phptnu�[���--TEST--
[READER] Properly handle NULL responses

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php

$reader = phpiredis_reader_create();

phpiredis_reader_feed($reader, "$-1\r\n");
$reply = phpiredis_reader_get_reply($reader);
var_dump($reply);

phpiredis_reader_feed($reader, "*-1\r\n");
$reply = phpiredis_reader_get_reply($reader);
var_dump($reply);

phpiredis_reader_feed($reader, "*1\r\n$-1\r\n");
$reply = phpiredis_reader_get_reply($reader);
var_dump($reply);

--EXPECT--
NULL
NULL
array(1) {
  [0]=>
  NULL
}
PK���\m��aaserializer_002.phptnu�[���--TEST--
[SERIALIZER] Command serialization with non-string arguments

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
var_dump(phpiredis_format_command(array('SET', 'key', 112)));
var_dump(phpiredis_format_command(array('SET', 'key', 1.2)));

--EXPECT--
string(31) "*3
$3
SET
$3
key
$3
112
"
string(31) "*3
$3
SET
$3
key
$3
1.2
"
PK���\��!z\\reader_008.phptnu�[���--TEST--
[READER] Custom error handler throwing exceptions or returning objects

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php

function error_handler_exception($err) {
    throw new Exception($err);
}

function error_handler_object($err) {
    $r = new stdClass();
    $r->err = $err;
    return $r;
}

$reader = phpiredis_reader_create();

phpiredis_reader_set_error_handler($reader, 'error_handler_exception');
phpiredis_reader_feed($reader, "-ERR\r\n");

try {
    phpiredis_reader_get_reply($reader);
    var_dump(FALSE);
} catch (Exception $e) {
    var_dump($e->getMessage() == 'ERR');
}

phpiredis_reader_set_error_handler($reader, 'error_handler_object');
phpiredis_reader_feed($reader, "-ERR\r\n");
var_dump(phpiredis_reader_get_reply($reader));

--EXPECT--
bool(true)
object(stdClass)#2 (1) {
  ["err"]=>
  string(3) "ERR"
}
PK���\�����client_011.phptnu�[���--TEST--
[CLIENT] Do not attempt to reconnect upon disconnection (pipeline)

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
require_once 'testsuite_utilities.inc';

$redis = create_phpiredis_connection(REDIS_HOST, REDIS_PORT);

phpiredis_command($redis, 'SET a 1');
var_dump(phpiredis_multi_command($redis, array(
	'GET a',
	'QUIT',
	'GET a')
));

--EXPECT--
array(3) {
  [0]=>
  string(1) "1"
  [1]=>
  string(2) "OK"
  [2]=>
  bool(false)
}
PK���\^�<��reader_006.phptnu�[���--TEST--
[READER] Set custom error handler

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php

$expectedErrorText = 'ERR after handler';


function error_handler($err) {
    return $err." after handler";
}

$reader = phpiredis_reader_create();

phpiredis_reader_feed($reader, "-ERR\r\n");
$reply = phpiredis_reader_get_reply($reader);
if ($reply !== 'ERR') {
    echo "Reply '$reply' != 'ERR' on line ".__LINE__." \n";
}

phpiredis_reader_set_error_handler($reader, 'error_handler');
phpiredis_reader_feed($reader, "-ERR\r\n");
$reply = phpiredis_reader_get_reply($reader);
if ($reply != $expectedErrorText) {
    echo "Reply '$reply' != '$expectedErrorText' on line ".__LINE__." \n";
}

$failResult = @phpiredis_reader_set_error_handler($reader, 'fake_error_handler');
if ($failResult !== FALSE) {
    echo "Did not get FALSE when creating a fake_error_handler \n";
}

phpiredis_reader_feed($reader, "-ERR\r\n");
$reply = phpiredis_reader_get_reply($reader);
if ($reply != $expectedErrorText) {
    echo "Reply '$reply' is not equal to '$expectedErrorText' on line ".__LINE__." \n";
}

$result = phpiredis_reader_set_error_handler($reader, NULL);
if ($result !== TRUE) {
    echo "Result '$result' is not true when setting NULL error handler'";
}

phpiredis_reader_feed($reader, "-ERR\r\n");
$reply = phpiredis_reader_get_reply($reader);
if ($reply !== 'ERR') {
    echo "Reply '$reply' is not equal to 'ERR' on line ".__LINE__." \n";
}

--EXPECT--
PK���\}�jvvtestsuite_configuration.incnu�[���<?php

define('REDIS_HOST', '127.0.0.1');
define('REDIS_PORT', 6379);
define('REDIS_UNIX_SOCKET', '/tmp/redis.sock');
PK���\+	�b��utils_001.phptnu�[���--TEST--
[UTILS] Calculate the CRC16 of strings

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
var_dump(phpiredis_utils_crc16('key:000'));
var_dump(phpiredis_utils_crc16('key:001'));
var_dump(phpiredis_utils_crc16('key:002'));
var_dump(phpiredis_utils_crc16('key:003'));
var_dump(phpiredis_utils_crc16('key:004'));
var_dump(phpiredis_utils_crc16('key:005'));
var_dump(phpiredis_utils_crc16('key:006'));
var_dump(phpiredis_utils_crc16('key:007'));
var_dump(phpiredis_utils_crc16('key:008'));
var_dump(phpiredis_utils_crc16('key:009'));

--EXPECTF--
int(58359)
int(62422)
int(50101)
int(54164)
int(41843)
int(45906)
int(33585)
int(37648)
int(25343)
int(29406)
PK���\����GGreader_002.phptnu�[���--TEST--
[READER] Feed reader and parse responses

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php

$reader = phpiredis_reader_create();

phpiredis_reader_feed($reader, "+OK\r\n");
phpiredis_reader_feed($reader, "-Error\r\n");

var_dump(phpiredis_reader_get_reply($reader));
var_dump(phpiredis_reader_get_reply($reader));
var_dump(phpiredis_reader_get_reply($reader)); // extra read

phpiredis_reader_feed($reader, ":123\r\n");
phpiredis_reader_feed($reader, "$3\r\nSET\r\n");
phpiredis_reader_feed($reader, "*3\r\n$3\r\nSET\r\n$1\r\na\r\n$2\r\nAS\r\n");
phpiredis_reader_feed($reader, "nSET\r\n");

var_dump(phpiredis_reader_get_reply($reader));
var_dump(phpiredis_reader_get_reply($reader));
var_dump(phpiredis_reader_get_reply($reader));
var_dump(phpiredis_reader_get_reply($reader));
var_dump(phpiredis_reader_get_error($reader));

--EXPECT--
string(2) "OK"
string(5) "Error"
bool(false)
int(123)
string(3) "SET"
array(3) {
  [0]=>
  string(3) "SET"
  [1]=>
  string(1) "a"
  [2]=>
  string(2) "AS"
}
bool(false)
string(42) "Protocol error, got "n" as reply type byte"
PK���\LQ�client_001.phptnu�[���--TEST--
[CLIENT] Connect to Redis

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
require_once 'testsuite_utilities.inc';

$redis = create_phpiredis_connection(REDIS_HOST, REDIS_PORT);
var_dump($redis);

--EXPECTF--
resource(%d) of type (phpredis connection)
PK���\��%݅�client_004.phptnu�[���--TEST--
[CLIENT] Execute commands

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
require_once 'testsuite_utilities.inc';

$redis = create_phpiredis_connection(REDIS_HOST, REDIS_PORT);

phpiredis_command($redis, 'DEL test');
phpiredis_command($redis, 'SET test 1');
$response = phpiredis_command($redis, 'GET test');

var_dump($response);

--EXPECT--
string(1) "1"
PK���\(P�XAAclient_002.phptnu�[���--TEST--
[CLIENT] Persistent and non-persistent connections

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
require_once 'testsuite_utilities.inc';

create_phpiredis_connection(REDIS_HOST, REDIS_PORT);
create_phpiredis_connection(REDIS_HOST, REDIS_PORT, TRUE);

echo "OK" . PHP_EOL;

--EXPECT--
OK
PK���\�I����client_009.phptnu�[���--TEST--
[CLIENT] Execute pipelined commands (binary safe)

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
require_once 'testsuite_utilities.inc';

$redis = create_phpiredis_connection(REDIS_HOST, REDIS_PORT);

$commands = phpiredis_multi_command_bs($redis, array(
    array('DEL', 'test'),
    array('SET', 'test', '1'),
    array('GET', 'test')
));

var_dump($commands[2]);

--EXPECT--
string(1) "1"
PK���\Fe��client_003.phptnu�[���--TEST--
[CLIENT] Persistent and non-persistent connections (UNIX socket)

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

if (!file_exists(REDIS_UNIX_SOCKET)) {
    die('skip Cannot find UNIX domain socket file at ' . REDIS_UNIX_SOCKET);
}

--FILE--
<?php
require_once 'testsuite_utilities.inc';

create_phpiredis_connection(REDIS_UNIX_SOCKET, 9999);
create_phpiredis_connection(REDIS_UNIX_SOCKET, NULL);
create_phpiredis_connection(REDIS_UNIX_SOCKET, NULL, TRUE);

echo "OK" . PHP_EOL;

--EXPECT--
OK
PK���\�Q�*ssreader_012.phptnu�[���--TEST--
[READER] Parameters formatting should not modify input argument.

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
$array = array('SET', 'key', 1);

var_dump(phpiredis_format_command($array));
var_dump($array);

--EXPECT--
string(29) "*3
$3
SET
$3
key
$1
1
"
array(3) {
  [0]=>
  string(3) "SET"
  [1]=>
  string(3) "key"
  [2]=>
  int(1)
}
PK���\@��;;reader_011.phptnu�[���--TEST--
[READER] Test regression for segfaults

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php
$reader = phpiredis_reader_create();

$buffer = "+OK\r\n";
phpiredis_reader_feed($reader, $buffer);
var_dump(phpiredis_reader_get_reply($reader));

$buffer = "+QUEUED\r\n";
phpiredis_reader_feed($reader, $buffer);
var_dump(phpiredis_reader_get_reply($reader));

$buffer = "*1\r\n:1\r\n";
phpiredis_reader_feed($reader, $buffer);
var_dump(phpiredis_reader_get_reply($reader));

--EXPECT--
string(2) "OK"
string(6) "QUEUED"
array(1) {
  [0]=>
  int(1)
}
PK���\�J�F��reader_003.phptnu�[���--TEST--
[READER] Check reader state

--SKIPIF--
<?php
require_once 'testsuite_skipif.inc';

--FILE--
<?php

$reader = phpiredis_reader_create();

phpiredis_reader_feed($reader, "+OK\r\n");
var_dump(phpiredis_reader_get_reply($reader));
var_dump(phpiredis_reader_get_state($reader) == PHPIREDIS_READER_STATE_INCOMPLETE);

phpiredis_reader_feed($reader, "+OK\r\n");
var_dump(phpiredis_reader_get_state($reader) == PHPIREDIS_READER_STATE_COMPLETE);
var_dump(phpiredis_reader_get_reply($reader));

phpiredis_reader_feed($reader, "$3\r\nSE");
var_dump(phpiredis_reader_get_state($reader) == PHPIREDIS_READER_STATE_INCOMPLETE);

phpiredis_reader_feed($reader, "T\r\n");
var_dump(phpiredis_reader_get_state($reader) == PHPIREDIS_READER_STATE_COMPLETE);
var_dump(phpiredis_reader_get_reply($reader));

phpiredis_reader_feed($reader, "nSET\r\n");
var_dump(phpiredis_reader_get_reply($reader) == FALSE);
var_dump(phpiredis_reader_get_state($reader) == PHPIREDIS_READER_STATE_ERROR);
var_dump(phpiredis_reader_get_error($reader));

--EXPECT--
string(2) "OK"
bool(true)
bool(true)
string(2) "OK"
bool(true)
bool(true)
string(3) "SET"
bool(true)
bool(true)
string(42) "Protocol error, got "n" as reply type byte"
PK���\a�����testsuite_skipif.incnu�[���PK���\%7�4���reader_010.phptnu�[���PK���\C����testsuite_utilities.incnu�[���PK���\rUXZ�reader_001.phptnu�[���PK���\��tzz�client_005.phptnu�[���PK���\V�:Y���client_008.phptnu�[���PK���\��ƻ��bserializer_001.phptnu�[���PK���\��G88�reader_005.phptnu�[���PK���\�6i?��client_007.phptnu�[���PK���\��a��reader_013.phptnu�[���PK���\_���reader_007.phptnu�[���PK���\j�Q��client_006.phptnu�[���PK���\
�6��Mclient_010.phptnu�[���PK���\iY�|areader_004.phptnu�[���PK���\ȳ�\�reader_009.phptnu�[���PK���\m��aa"serializer_002.phptnu�[���PK���\��!z\\�#reader_008.phptnu�[���PK���\�����T'client_011.phptnu�[���PK���\^�<��e)reader_006.phptnu�[���PK���\}�jvvb/testsuite_configuration.incnu�[���PK���\+	�b��#0utils_001.phptnu�[���PK���\����GG3reader_002.phptnu�[���PK���\LQ��7client_001.phptnu�[���PK���\��%݅��8client_004.phptnu�[���PK���\(P�XAA�:client_002.phptnu�[���PK���\�I����/<client_009.phptnu�[���PK���\Fe��>client_003.phptnu�[���PK���\�Q�*ssT@reader_012.phptnu�[���PK���\@��;;Breader_011.phptnu�[���PK���\�J�F���Dreader_003.phptnu�[���PKb	pI