File tree Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -246,10 +246,9 @@ zend_bool s_memc_valid_key_ascii(zend_string *key)
246246#define MEMC_CHECK_KEY (intern , key ) \
247247 if (UNEXPECTED(ZSTR_LEN(key) == 0 || \
248248 ZSTR_LEN(key) > MEMC_OBJECT_KEY_MAX_LENGTH || \
249- memcached_behavior_get(intern->memc, MEMCACHED_BEHAVIOR_VERIFY_KEY) && \
250249 (memcached_behavior_get(intern->memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) \
251250 ? !s_memc_valid_key_binary(key) \
252- : !s_memc_valid_key_ascii(key) \
251+ : (memcached_behavior_get(intern->memc, MEMCACHED_BEHAVIOR_VERIFY_KEY) && !s_memc_valid_key_ascii(key)) \
253252 ))) { \
254253 intern->rescode = MEMCACHED_BAD_KEY_PROVIDED; \
255254 RETURN_FALSE; \
Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ Memcached::get()
55--FILE--
66<?php
77include dirname (__FILE__ ) . '/config.inc ' ;
8- $ m = memc_get_instance ();
8+ $ m = memc_get_instance (array (
9+ Memcached::OPT_BINARY_PROTOCOL => false ,
10+ Memcached::OPT_VERIFY_KEY => true
11+ ));
912
1013$ m ->delete ('foo ' );
1114
Original file line number Diff line number Diff line change @@ -8,11 +8,8 @@ Test valid and invalid keys - ascii
88include dirname (__FILE__ ) . '/config.inc ' ;
99$ ascii = memc_get_instance (array (
1010 Memcached::OPT_BINARY_PROTOCOL => false ,
11- Memcached::OPT_VERIFY_KEY => false
11+ Memcached::OPT_VERIFY_KEY => true
1212 ));
13- // libmemcached can verify keys, but these are tests are for our own
14- // function s_memc_valid_key_ascii, so explicitly disable the checks
15- // that libmemcached can perform.
1613
1714echo 'ASCII: SPACES ' . PHP_EOL ;
1815var_dump ($ ascii ->set ('ascii key with spaces ' , 'this is a test ' ));
You can’t perform that action at this time.
0 commit comments