Add an INI setting returning 5.x legacy behavior -- readonly session on lock failure

This commit is contained in:
Anton Smirnov
2025-07-08 08:29:51 +03:00
committed by Michael Grunder
parent 152fdda9b1
commit 8dada174c4
2 changed files with 9 additions and 3 deletions
+1
View File
@@ -114,6 +114,7 @@ PHP_INI_BEGIN()
PHP_INI_ENTRY("redis.session.lock_expire", "0", PHP_INI_ALL, NULL)
PHP_INI_ENTRY("redis.session.lock_retries", "100", PHP_INI_ALL, NULL)
PHP_INI_ENTRY("redis.session.lock_wait_time", "20000", PHP_INI_ALL, NULL)
PHP_INI_ENTRY("redis.session.lock_failure_readonly", "0", PHP_INI_ALL, NULL)
PHP_INI_ENTRY("redis.session.early_refresh", "0", PHP_INI_ALL, NULL)
PHP_INI_ENTRY("redis.session.compression", "none", PHP_INI_ALL, NULL)
PHP_INI_ENTRY("redis.session.compression_level", "3", PHP_INI_ALL, NULL)
+8 -3
View File
@@ -777,9 +777,14 @@ PS_READ_FUNC(redis)
}
if (lock_acquire(redis_sock, &pool->lock_status) != SUCCESS) {
php_error_docref(NULL, E_WARNING, "Failed to acquire session lock");
efree(cmd);
return FAILURE;
if (INI_INT("redis.session.lock_failure_readonly")) {
// opt-in legacy behavior: readonly session
php_error_docref(NULL, E_WARNING, "Failed to acquire session lock, session will be read only");
} else {
php_error_docref(NULL, E_WARNING, "Failed to acquire session lock");
efree(cmd);
return FAILURE;
}
}
if (redis_sock_write(redis_sock, cmd, cmd_len) < 0) {