File tree 3 files changed +6
-7
lines changed
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)
246
246
#define MEMC_CHECK_KEY (intern , key ) \
247
247
if (UNEXPECTED(ZSTR_LEN(key) == 0 || \
248
248
ZSTR_LEN(key) > MEMC_OBJECT_KEY_MAX_LENGTH || \
249
- memcached_behavior_get(intern->memc, MEMCACHED_BEHAVIOR_VERIFY_KEY) && \
250
249
(memcached_behavior_get(intern->memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) \
251
250
? !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)) \
253
252
))) { \
254
253
intern->rescode = MEMCACHED_BAD_KEY_PROVIDED; \
255
254
RETURN_FALSE; \
Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ Memcached::get()
5
5
--FILE--
6
6
<?php
7
7
include 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
+ ));
9
12
10
13
$ m ->delete ('foo ' );
11
14
Original file line number Diff line number Diff line change @@ -8,11 +8,8 @@ Test valid and invalid keys - ascii
8
8
include dirname (__FILE__ ) . '/config.inc ' ;
9
9
$ ascii = memc_get_instance (array (
10
10
Memcached::OPT_BINARY_PROTOCOL => false ,
11
- Memcached::OPT_VERIFY_KEY => false
11
+ Memcached::OPT_VERIFY_KEY => true
12
12
));
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.
16
13
17
14
echo 'ASCII: SPACES ' . PHP_EOL ;
18
15
var_dump ($ ascii ->set ('ascii key with spaces ' , 'this is a test ' ));
You can’t perform that action at this time.
0 commit comments