Skip to content

Commit f54ed29

Browse files
committed
Use STD_PHP_INI_BOOLEAN to correctly display php.ini booleans
1 parent deb451a commit f54ed29

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Diff for: php_memcached.c

+17-9
Original file line numberDiff line numberDiff line change
@@ -326,34 +326,40 @@ PHP_INI_MH(OnUpdateSessionPrefixString)
326326
#define MEMC_INI_ENTRY(key, default_value, update_fn, gkey) \
327327
STD_PHP_INI_ENTRY("memcached."key, default_value, PHP_INI_ALL, update_fn, memc.gkey, zend_php_memcached_globals, php_memcached_globals)
328328

329+
#define MEMC_INI_BOOL(key, default_value, update_fn, gkey) \
330+
STD_PHP_INI_BOOLEAN("memcached."key, default_value, PHP_INI_ALL, update_fn, memc.gkey, zend_php_memcached_globals, php_memcached_globals)
331+
329332
#define MEMC_SESSION_INI_ENTRY(key, default_value, update_fn, gkey) \
330333
STD_PHP_INI_ENTRY("memcached.sess_"key, default_value, PHP_INI_ALL, update_fn, session.gkey, zend_php_memcached_globals, php_memcached_globals)
331334

335+
#define MEMC_SESSION_INI_BOOL(key, default_value, update_fn, gkey) \
336+
STD_PHP_INI_BOOLEAN("memcached.sess_"key, default_value, PHP_INI_ALL, update_fn, session.gkey, zend_php_memcached_globals, php_memcached_globals)
337+
332338

333339
/* {{{ INI entries */
334340
PHP_INI_BEGIN()
335341

336342
#ifdef HAVE_MEMCACHED_SESSION
337-
MEMC_SESSION_INI_ENTRY("locking", "1", OnUpdateBool, lock_enabled)
343+
MEMC_SESSION_INI_BOOL ("locking", "1", OnUpdateBool, lock_enabled)
338344
MEMC_SESSION_INI_ENTRY("lock_wait_min", "1000", OnUpdateLongGEZero, lock_wait_min)
339345
MEMC_SESSION_INI_ENTRY("lock_wait_max", "2000", OnUpdateLongGEZero, lock_wait_max)
340346
MEMC_SESSION_INI_ENTRY("lock_retries", "5", OnUpdateLong, lock_retries)
341347
MEMC_SESSION_INI_ENTRY("lock_expire", "0", OnUpdateLongGEZero, lock_expiration)
342348
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX < 0x01000018
343-
MEMC_SESSION_INI_ENTRY("binary_protocol", "0", OnUpdateBool, binary_protocol_enabled)
349+
MEMC_SESSION_INI_BOOL ("binary_protocol", "0", OnUpdateBool, binary_protocol_enabled)
344350
#else
345-
MEMC_SESSION_INI_ENTRY("binary_protocol", "1", OnUpdateBool, binary_protocol_enabled)
351+
MEMC_SESSION_INI_BOOL ("binary_protocol", "1", OnUpdateBool, binary_protocol_enabled)
346352
#endif
347-
MEMC_SESSION_INI_ENTRY("consistent_hash", "1", OnUpdateBool, consistent_hash_enabled)
353+
MEMC_SESSION_INI_BOOL ("consistent_hash", "1", OnUpdateBool, consistent_hash_enabled)
348354
MEMC_SESSION_INI_ENTRY("number_of_replicas", "0", OnUpdateLongGEZero, number_of_replicas)
349-
MEMC_SESSION_INI_ENTRY("randomize_replica_read", "0", OnUpdateBool, randomize_replica_read_enabled)
350-
MEMC_SESSION_INI_ENTRY("remove_failed_servers", "0", OnUpdateBool, remove_failed_servers_enabled)
355+
MEMC_SESSION_INI_BOOL ("randomize_replica_read", "0", OnUpdateBool, randomize_replica_read_enabled)
356+
MEMC_SESSION_INI_BOOL ("remove_failed_servers", "0", OnUpdateBool, remove_failed_servers_enabled)
351357
MEMC_SESSION_INI_ENTRY("server_failure_limit", "0", OnUpdateLongGEZero, server_failure_limit)
352358
MEMC_SESSION_INI_ENTRY("connect_timeout", "0", OnUpdateLongGEZero, connect_timeout)
353359
MEMC_SESSION_INI_ENTRY("sasl_username", "", OnUpdateString, sasl_username)
354360
MEMC_SESSION_INI_ENTRY("sasl_password", "", OnUpdateString, sasl_password)
361+
MEMC_SESSION_INI_BOOL ("persistent", "0", OnUpdateBool, persistent_enabled)
355362
MEMC_SESSION_INI_ENTRY("prefix", "memc.sess.key.", OnUpdateSessionPrefixString, prefix)
356-
MEMC_SESSION_INI_ENTRY("persistent", "0", OnUpdateBool, persistent_enabled)
357363

358364
/* Deprecated */
359365
STD_PHP_INI_ENTRY("memcached.sess_lock_wait", "not set", PHP_INI_ALL, OnUpdateDeprecatedLockValue, no_effect, zend_php_memcached_globals, php_memcached_globals)
@@ -367,14 +373,16 @@ PHP_INI_BEGIN()
367373
MEMC_INI_ENTRY("serializer", SERIALIZER_DEFAULT_NAME, OnUpdateSerializer, serializer_name)
368374
MEMC_INI_ENTRY("store_retry_count", "2", OnUpdateLong, store_retry_count)
369375

370-
MEMC_INI_ENTRY("default_consistent_hash", "0", OnUpdateBool, default_behavior.consistent_hash_enabled)
371-
MEMC_INI_ENTRY("default_binary_protocol", "0", OnUpdateBool, default_behavior.binary_protocol_enabled)
376+
MEMC_INI_BOOL ("default_consistent_hash", "0", OnUpdateBool, default_behavior.consistent_hash_enabled)
377+
MEMC_INI_BOOL ("default_binary_protocol", "0", OnUpdateBool, default_behavior.binary_protocol_enabled)
372378
MEMC_INI_ENTRY("default_connect_timeout", "0", OnUpdateLongGEZero, default_behavior.connect_timeout)
373379

374380
PHP_INI_END()
375381
/* }}} */
376382

383+
#undef MEMC_INI_BOOL
377384
#undef MEMC_INI_ENTRY
385+
#undef MEMC_SESSION_INI_BOOL
378386
#undef MEMC_SESSION_INI_ENTRY
379387

380388
/****************************************

0 commit comments

Comments
 (0)