Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d3b2d87

Browse files
Don't use $k1 as a variable name.
There is a very strange edge case whn you try to run PHP under valgrind and use certain specific strings like "$k1". PHP interns these values in such a way that valgrind can't handle it and hard aborts on sigsegv. I don't know what the actual cause is but simply renaming the variables is a workaround.
1 parent f8c762e commit d3b2d87

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

tests/RedisTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,41 +1449,41 @@ public function testlMove() {
14491449
if (version_compare($this->version, '6.2.0') < 0)
14501450
$this->markTestSkipped();
14511451

1452-
[$k1, $k2] = ['{l}0', '{l}1'];
1452+
[$list1, $list2] = ['{l}0', '{l}1'];
14531453
$left = $this->getLeftConstant();
14541454
$right = $this->getRightConstant();
14551455

1456-
$this->redis->del($k1, $k2);
1457-
$this->redis->lPush($k1, 'a');
1458-
$this->redis->lPush($k1, 'b');
1459-
$this->redis->lPush($k1, 'c');
1456+
$this->redis->del($list1, $list2);
1457+
$this->redis->lPush($list1, 'a');
1458+
$this->redis->lPush($list1, 'b');
1459+
$this->redis->lPush($list1, 'c');
14601460

1461-
$return = $this->redis->lMove($k1, $k2, $left, $right);
1461+
$return = $this->redis->lMove($list1, $list2, $left, $right);
14621462
$this->assertEquals('c', $return);
14631463

1464-
$return = $this->redis->lMove($k1, $k2, $right, $left);
1464+
$return = $this->redis->lMove($list1, $list2, $right, $left);
14651465
$this->assertEquals('a', $return);
14661466

1467-
$this->assertEquals(['b'], $this->redis->lRange($k1, 0, -1));
1468-
$this->assertEquals(['a', 'c'], $this->redis->lRange($k2, 0, -1));
1467+
$this->assertEquals(['b'], $this->redis->lRange($list1, 0, -1));
1468+
$this->assertEquals(['a', 'c'], $this->redis->lRange($list2, 0, -1));
14691469

14701470
}
14711471

14721472
public function testBlmove() {
14731473
if (version_compare($this->version, '6.2.0') < 0)
14741474
$this->markTestSkipped();
14751475

1476-
[$k1, $k2] = ['{l}0', '{l}1'];
1476+
[$list1, $list2] = ['{l}0', '{l}1'];
14771477
$left = $this->getLeftConstant();
14781478

1479-
$this->redis->del($k1, $k2);
1480-
$this->redis->rpush($k1, 'a');
1479+
$this->redis->del($list1, $list2);
1480+
$this->redis->rpush($list1, 'a');
14811481

14821482

1483-
$this->assertEquals('a', $this->redis->blmove($k1, $k2, $left, $left, 1.));
1483+
$this->assertEquals('a', $this->redis->blmove($list1, $list2, $left, $left, 1.));
14841484

14851485
$st = microtime(true);
1486-
$ret = $this->redis->blmove($k1, $k2, $left, $left, .1);
1486+
$ret = $this->redis->blmove($list1, $list2, $left, $left, .1);
14871487
$et = microtime(true);
14881488

14891489
$this->assertFalse($ret);

0 commit comments

Comments
 (0)