From 847afcae9b6a0570dca96e23d8adf94831a09b4c Mon Sep 17 00:00:00 2001 From: jvoisin Date: Tue, 13 May 2025 16:24:50 +0200 Subject: Remove the useless show_old_php_warning feature People are usually well-aware of the outdatedness of the PHP version they're running, which is likely why they're running Snuffleupagus in the first place. This feature shouldn't have been enabled by default, and I fail to see any case where anyone would want to enable it. Moreover, it doesn't take LTS versions from vendors/distributions into account, thus breaking on RHEL/Debian (old)stable. --- src/php_snuffleupagus.h | 1 - src/snuffleupagus.c | 12 ------------ src/sp_config.h | 1 - src/sp_config_keywords.c | 1 - 4 files changed, 15 deletions(-) (limited to 'src') diff --git a/src/php_snuffleupagus.h b/src/php_snuffleupagus.h index 1f122e3..b738ae8 100644 --- a/src/php_snuffleupagus.h +++ b/src/php_snuffleupagus.h @@ -148,7 +148,6 @@ bool config_server_encode; bool config_server_strip; zend_string *config_encryption_key; zend_string *config_cookies_env_var; -bool config_show_old_php_warning; HashTable *config_disabled_functions; HashTable *config_disabled_functions_hooked; diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c index 22aca04..6264d22 100644 --- a/src/snuffleupagus.c +++ b/src/snuffleupagus.c @@ -361,7 +361,6 @@ static void dump_config(void) { add_assoc_long(&arr, SP_TOKEN_GLOBAL "." SP_TOKEN_MAX_EXECUTION_DEPTH, SPCFG(max_execution_depth)); add_assoc_bool(&arr, SP_TOKEN_GLOBAL "." SP_TOKEN_SERVER_ENCODE, SPCFG(server_encode)); add_assoc_bool(&arr, SP_TOKEN_GLOBAL "." SP_TOKEN_SERVER_STRIP, SPCFG(server_strip)); - add_assoc_bool(&arr, SP_TOKEN_GLOBAL "." SP_TOKEN_SHOW_OLD_PHP_WARNING, SPCFG(show_old_php_warning)); add_assoc_bool(&arr, SP_TOKEN_AUTO_COOKIE_SECURE, SPCFG(auto_cookie_secure).enable); add_assoc_bool(&arr, SP_TOKEN_XXE_PROTECTION, SPCFG(xxe_protection).enable); @@ -501,7 +500,6 @@ static PHP_INI_MH(OnUpdateConfiguration) { } // set some defaults - SPCFG(show_old_php_warning) = true; SPCFG(readonly_exec).extended_checks = true; char *str = new_value->val; @@ -606,16 +604,6 @@ static PHP_INI_MH(OnUpdateConfiguration) { (SPCFG(disabled_functions) && zend_hash_num_elements(SPCFG(disabled_functions))) || (SPCFG(disabled_functions_ret) && zend_hash_num_elements(SPCFG(disabled_functions_ret))); - if (SPCFG(show_old_php_warning) && getenv("SP_SKIP_OLD_PHP_CHECK") == NULL) { - const time_t ts = time(NULL); - if ((PHP_VERSION_ID < 80100) || - (PHP_VERSION_ID < 80200 && ts >= (time_t)1732492800L) || - (PHP_VERSION_ID < 80300 && ts >= (time_t)1765152000L) || - (PHP_VERSION_ID < 80400 && ts >= (time_t)1795392000L)) { - sp_log_warn("End-of-Life Check", "Your PHP version '" PHP_VERSION "' is not officially maintained anymore, see https://www.php.net/supported-versions.php for details. " \ - "Please upgrade as soon as possible."); - } - } return SUCCESS; } diff --git a/src/sp_config.h b/src/sp_config.h index 407c9bd..fb25fdb 100644 --- a/src/sp_config.h +++ b/src/sp_config.h @@ -272,7 +272,6 @@ typedef struct { #define SP_TOKEN_SERVER_STRIP "server_strip" #define SP_TOKEN_SID_MIN_LENGTH "sid_min_length" #define SP_TOKEN_SID_MAX_LENGTH "sid_max_length" -#define SP_TOKEN_SHOW_OLD_PHP_WARNING "show_old_php_warning" // upload_validator #define SP_TOKEN_UPLOAD_SCRIPT "script" diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index ba9ee7c..796b44b 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c @@ -148,7 +148,6 @@ SP_PARSE_FN(parse_global) { {parse_uint, SP_TOKEN_MAX_EXECUTION_DEPTH, &(SPCFG(max_execution_depth))}, {parse_enable, SP_TOKEN_SERVER_ENCODE, &(SPCFG(server_encode))}, {parse_enable, SP_TOKEN_SERVER_STRIP, &(SPCFG(server_strip))}, - {parse_enable, SP_TOKEN_SHOW_OLD_PHP_WARNING, &(SPCFG(show_old_php_warning))}, {0, 0, 0}}; SP_PROCESS_CONFIG_KEYWORDS_ERR(); -- cgit v1.3