Commit d63fb997e28 for php.net
commit d63fb997e2836b14a1ff33e9480b7d3b7d3f2c95
Author: Giovanni Giacobbi <giovanni@giacobbi.net>
Date: Wed Mar 18 13:31:43 2026 +0100
ext/session: code cleanup - use single empty line except for sections
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 9902dacf7a9..60c6bfc1bd4 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -103,7 +103,6 @@ const ps_module ps_mod_files = {
PS_MOD_UPDATE_TIMESTAMP(files)
};
-
static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, const zend_string *key)
{
const char *p;
@@ -346,10 +345,8 @@ static zend_result ps_files_key_exists(ps_files *data, const zend_string *key)
return SUCCESS;
}
-
#define PS_FILES_DATA ps_files *data = PS_GET_MOD_DATA()
-
/*
* Open save handler. Setup resources that are needed by the handler.
* PARAMETERS: PS_OPEN_ARGS in php_session.h
@@ -427,7 +424,6 @@ PS_OPEN_FUNC(files)
return SUCCESS;
}
-
/*
* Clean up opened resources.
* PARAMETERS: PS_CLOSE_ARGS in php_session.h
@@ -456,7 +452,6 @@ PS_CLOSE_FUNC(files)
return SUCCESS;
}
-
/*
* Read session data from opened resource.
* PARAMETERS: PS_READ_ARGS in php_session.h
@@ -531,7 +526,6 @@ PS_READ_FUNC(files)
return SUCCESS;
}
-
/*
* Write session data.
* PARAMETERS: PS_WRITE_ARGS in php_session.h
@@ -547,7 +541,6 @@ PS_WRITE_FUNC(files)
return ps_files_write(data, key, val);
}
-
/*
* Update session data modification/access time stamp.
* PARAMETERS: PS_UPDATE_TIMESTAMP_ARGS in php_session.h
@@ -582,7 +575,6 @@ PS_UPDATE_TIMESTAMP_FUNC(files)
return SUCCESS;
}
-
/*
* Delete session data.
* PARAMETERS: PS_DESTROY_ARGS in php_session.h
@@ -617,7 +609,6 @@ PS_DESTROY_FUNC(files)
return SUCCESS;
}
-
/*
* Cleanup expired session data.
* PARAMETERS: PS_GC_ARGS in php_session.h
@@ -646,7 +637,6 @@ PS_GC_FUNC(files)
return *nrdels;
}
-
/*
* Create session ID.
* PARAMETERS: PS_CREATE_SID_ARGS in php_session.h
@@ -689,7 +679,6 @@ PS_CREATE_SID_FUNC(files)
return sid;
}
-
/*
* Check session ID existence for use_strict_mode support.
* PARAMETERS: PS_VALIDATE_SID_ARGS in php_session.h
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 6f7c913ad3e..a83f1bd36f8 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -22,7 +22,6 @@ const ps_module ps_mod_user = {
PS_MOD_UPDATE_TIMESTAMP(user)
};
-
static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval)
{
int i;
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 7596c3a3368..09a737cf64f 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -95,7 +95,6 @@ typedef struct ps_module_struct {
ps_delete_##x, ps_gc_##x, ps_create_sid_##x, \
ps_validate_sid_##x, ps_update_timestamp_##x
-
typedef enum {
php_session_disabled,
php_session_none,
diff --git a/ext/session/session.c b/ext/session/session.c
index 1af2479187d..bff142fa372 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -76,6 +76,7 @@ zend_class_entry *php_session_update_timestamp_iface_entry;
#define PS_MAX_SID_LENGTH 256
+
/* ***********
* Helpers *
*********** */
@@ -386,7 +387,6 @@ PHPAPI zend_result php_session_valid_key(const char *key)
return SUCCESS;
}
-
static zend_long php_session_gc(bool immediate)
{
zend_long sessions_deleted = -1;
@@ -564,6 +564,7 @@ static void php_session_normalize_vars(void)
}
}
+
/* *************************
* INI Settings/Handlers *
************************* */
@@ -664,7 +665,6 @@ static PHP_INI_MH(OnUpdateSaveDir)
return OnUpdateStr(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
-
static PHP_INI_MH(OnUpdateName)
{
SESSION_CHECK_ACTIVE_STATE;
@@ -695,7 +695,6 @@ static PHP_INI_MH(OnUpdateName)
return OnUpdateStrNotEmpty(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
-
static PHP_INI_MH(OnUpdateCookieLifetime)
{
SESSION_CHECK_ACTIVE_STATE;
@@ -716,7 +715,6 @@ static PHP_INI_MH(OnUpdateCookieLifetime)
return OnUpdateLongGEZero(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
-
static PHP_INI_MH(OnUpdateSessionLong)
{
SESSION_CHECK_ACTIVE_STATE;
@@ -731,7 +729,6 @@ static PHP_INI_MH(OnUpdateSessionStr)
return OnUpdateStr(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
-
static PHP_INI_MH(OnUpdateSessionBool)
{
SESSION_CHECK_ACTIVE_STATE;
@@ -739,7 +736,6 @@ static PHP_INI_MH(OnUpdateSessionBool)
return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
-
static PHP_INI_MH(OnUpdateSidLength)
{
zend_long val;
@@ -917,9 +913,11 @@ PHP_INI_BEGIN()
/* PHP_INI_ENTRY("session.encode_sources", "globals,track", PHP_INI_ALL, NULL) */
PHP_INI_END()
+
/* ***************
* Serializers *
*************** */
+
PS_SERIALIZER_ENCODE_FUNC(php_serialize)
{
smart_str buf = {0};
@@ -1130,6 +1128,7 @@ PHPAPI zend_result php_session_register_serializer(const char *name, zend_string
return ret;
}
+
/* *******************
* Storage Modules *
******************* */
@@ -1311,6 +1310,7 @@ static int php_session_cache_limiter(void)
return -1;
}
+
/* *********************
* Cookie Management *
********************* */
@@ -1548,7 +1548,6 @@ static void proposed_session_id_to_session_id(const zval *proposed_session_id) {
}
}
-
PHPAPI zend_result php_session_reset_id(void)
{
int module_number = PS(module_number);
@@ -1627,7 +1626,6 @@ PHPAPI zend_result php_session_reset_id(void)
return SUCCESS;
}
-
PHPAPI zend_result php_session_start(void)
{
switch (PS(session_status)) {
@@ -1738,6 +1736,7 @@ static bool php_session_reset(void)
return PS(session_status) == php_session_active && php_session_initialize() == SUCCESS;
}
+
/* ********************************
* Userspace exported functions *
******************************** */
@@ -2676,7 +2675,6 @@ PHP_FUNCTION(session_gc)
RETURN_LONG(num);
}
-
PHP_FUNCTION(session_write_close)
{
ZEND_PARSE_PARAMETERS_NONE();
@@ -2740,6 +2738,7 @@ PHP_FUNCTION(session_register_shutdown)
}
}
+
/* ********************************
* Module Setup and Destruction *
******************************** */
@@ -2787,7 +2786,6 @@ static PHP_RINIT_FUNCTION(session)
ZVAL_UNDEF(&PS(mod_user_names).struct_name); \
}
-
static PHP_RSHUTDOWN_FUNCTION(session)
{
if (PS(session_status) == php_session_active) {
@@ -2958,6 +2956,7 @@ static PHP_MINFO_FUNCTION(session)
DISPLAY_INI_ENTRIES();
}
+
/* ************************
* Upload hook handling *
************************ */