facebook / facebook/hhvm

Memcached delete return value discrepancy

Open
#5,121 1 comment 0 reactions 0 assignees View on GitHub
php5 incompatibility
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

I found a PHP5 incompatibility when writing tests for a caching library and boiled it down to this test:

```
vagrant@precise64:/vagrant$ cat test.php
addServer('localhost', 11211);
$memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$memcached->setOption(Memcached::OPT_TCP_NODELAY, true);

$this->assertFalse($memcached->delete("no_key"));

$memcached->set('key', 'value');
$memcached->get('key');
$this->assertTrue($memcached->delete('key'));
$this->assertFalse($memcached->delete('key'));
}
}
vagrant@precise64:/vagrant$ php phpunit.phar test.php
PHPUnit 4.2.6 by Sebastian Bergmann.

.

Time: 9 ms, Memory: 5.00Mb

OK (1 test, 3 assertions)
vagrant@precise64:/vagrant$ sudo hhvm phpunit.phar test.php
[Fri Apr 3 06:33:46 2015] [hphp] [1714:7f0761d6cc00:0:000001] [] Possible bad config node: Eval.JitWarmupRequests
PHPUnit 4.2.6 by Sebastian Bergmann.

F

Time: 737 ms, Memory: 17.10Mb

There was 1 failure:

1) MemcachedTest::testDelete
Failed asserting that true is false.

/vagrant/test.php:15

FAILURES!
Tests: 1, Assertions: 3, Failures: 1.
vagrant@precise64:/vagrant$ hhvm --version
HipHop VM 3.4.0-dev (rel)
Compiler: heads/master-0-g850d4fddd26ee0c2a0022e390d6403ad9c4ecf79
Repo schema: 23aaab89219bb9d5009914de0d405cf694e2632e
Extension API: 20140829
```

Both of the `Memcached` options are required to make it fail as well as the `get` and `set` immediately prior.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.