Skip to content

Add support for libmemcached encryption #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 20, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Exploring behavior changes in libmemcached 1.0.18 set_encoding_key
  • Loading branch information
sodabrew committed Jan 20, 2018
commit cf81e92f6c80292d7f0c6135c208b804546121d0
7 changes: 6 additions & 1 deletion tests/set_encoding_key.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Test libmemcached encryption
include dirname (__FILE__) . '/config.inc';
if (!extension_loaded("memcached")) die ("skip");
if (!Memcached::HAVE_ENCODING) die ("skip no set_encoding_key support enabled");
// if (Memcached::LIBMEMCACHED_VERSION_HEX >= 0x01000018) die ("skip test for libmemcached 1.0.18 and higher");
if (Memcached::LIBMEMCACHED_VERSION_HEX >= 0x01000018) die ("skip test for libmemcached 1.0.18 and higher");
?>
--FILE--
<?php
Expand Down Expand Up @@ -52,3 +52,8 @@ OK
bool(true)
string(18) "set using encoding"
OK
bool(true)
bool(false)
bool(true)
string(18) "set using encoding"
OK
14 changes: 11 additions & 3 deletions tests/set_encoding_key2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Test libmemcached encryption
include dirname (__FILE__) . '/config.inc';
if (!extension_loaded("memcached")) die ("skip");
if (!Memcached::HAVE_ENCODING) die ("skip no set_encoding_key support enabled");
// if (Memcached::LIBMEMCACHED_VERSION_HEX >= 0x01000018) die ("skip test for libmemcached lower than 1.0.18");
if (Memcached::LIBMEMCACHED_VERSION_HEX < 0x01000018) die ("skip test for libmemcached lower than 1.0.18");
?>
--FILE--
<?php
Expand All @@ -31,7 +31,10 @@ var_dump ($m->get ($key));

echo "OK" . PHP_EOL;

# New values cannot be written after the key has changed in libmemcached < 1.0.18.
# Once the encoding key has changes we are no longer able to
# write new values in libmemcached < 1.0.18.
var_dump ($m->setEncodingKey("World"));
var_dump ($m->get ($key));
var_dump ($m->set ($key, 'set using encoding'));
var_dump ($m->get ($key));

Expand All @@ -46,6 +49,11 @@ OK
bool(true)
bool(false)
OK
bool(true)
string(18) "set using encoding"
OK
bool(true)
bool(false)
bool(false)
bool(true)
string(18) "set using encoding"
OK