diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c index d6312c5fa1f..8af6dc77068 100644 --- a/ext/session/mod_mm.c +++ b/ext/session/mod_mm.c @@ -40,11 +40,11 @@ typedef struct ps_sd { struct ps_sd *next; - uint32_t hv; /* hash value of key */ - time_t ctime; /* time of last change */ + uint32_t hv; /* hash value of key */ + time_t ctime; /* time of last change */ void *data; - size_t datalen; /* amount of valid data */ - size_t alloclen; /* amount of allocated memory for data */ + size_t datalen; /* amount of valid data */ + size_t alloclen; /* amount of allocated memory for data */ zend_string *key; } ps_sd; diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c index eb5a47b19ce..9adc97e6741 100644 --- a/ext/session/mod_user_class.c +++ b/ext/session/mod_user_class.c @@ -17,7 +17,7 @@ #include "php.h" #include "php_session.h" -#define PS_SANITY_CHECK \ +#define PS_SANITY_CHECK \ if (PS(session_status) != php_session_active) { \ zend_throw_error(NULL, "Session is not active"); \ RETURN_THROWS(); \ @@ -27,11 +27,11 @@ RETURN_THROWS(); \ } -#define PS_SANITY_CHECK_IS_OPEN \ +#define PS_SANITY_CHECK_IS_OPEN \ PS_SANITY_CHECK; \ - if (!PS(mod_user_is_open)) { \ - php_error_docref(NULL, E_WARNING, "Parent session handler is not open"); \ - RETURN_FALSE; \ + if (!PS(mod_user_is_open)) { \ + php_error_docref(NULL, E_WARNING, "Parent session handler is not open"); \ + RETURN_FALSE; \ } PHP_METHOD(SessionHandler, open) diff --git a/ext/session/php_session.h b/ext/session/php_session.h index b7ed88a8f6c..0588d217703 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -52,15 +52,15 @@ typedef struct ps_module_struct { #define PS_GET_MOD_DATA() *mod_data #define PS_SET_MOD_DATA(a) *mod_data = (a) -#define PS_OPEN_FUNC(x) zend_result ps_open_##x(PS_OPEN_ARGS) -#define PS_CLOSE_FUNC(x) zend_result ps_close_##x(PS_CLOSE_ARGS) -#define PS_READ_FUNC(x) zend_result ps_read_##x(PS_READ_ARGS) -#define PS_WRITE_FUNC(x) zend_result ps_write_##x(PS_WRITE_ARGS) -#define PS_DESTROY_FUNC(x) zend_result ps_delete_##x(PS_DESTROY_ARGS) -#define PS_GC_FUNC(x) zend_long ps_gc_##x(PS_GC_ARGS) -#define PS_CREATE_SID_FUNC(x) zend_string *ps_create_sid_##x(PS_CREATE_SID_ARGS) -#define PS_VALIDATE_SID_FUNC(x) zend_result ps_validate_sid_##x(PS_VALIDATE_SID_ARGS) -#define PS_UPDATE_TIMESTAMP_FUNC(x) zend_result ps_update_timestamp_##x(PS_UPDATE_TIMESTAMP_ARGS) +#define PS_OPEN_FUNC(x) zend_result ps_open_##x(PS_OPEN_ARGS) +#define PS_CLOSE_FUNC(x) zend_result ps_close_##x(PS_CLOSE_ARGS) +#define PS_READ_FUNC(x) zend_result ps_read_##x(PS_READ_ARGS) +#define PS_WRITE_FUNC(x) zend_result ps_write_##x(PS_WRITE_ARGS) +#define PS_DESTROY_FUNC(x) zend_result ps_delete_##x(PS_DESTROY_ARGS) +#define PS_GC_FUNC(x) zend_long ps_gc_##x(PS_GC_ARGS) +#define PS_CREATE_SID_FUNC(x) zend_string *ps_create_sid_##x(PS_CREATE_SID_ARGS) +#define PS_VALIDATE_SID_FUNC(x) zend_result ps_validate_sid_##x(PS_VALIDATE_SID_ARGS) +#define PS_UPDATE_TIMESTAMP_FUNC(x) zend_result ps_update_timestamp_##x(PS_UPDATE_TIMESTAMP_ARGS) /* Save handler module definitions without timestamp enabled */ #define PS_FUNCS(x) \ @@ -69,7 +69,7 @@ typedef struct ps_module_struct { PS_READ_FUNC(x); \ PS_WRITE_FUNC(x); \ PS_DESTROY_FUNC(x); \ - PS_GC_FUNC(x); \ + PS_GC_FUNC(x); \ PS_CREATE_SID_FUNC(x); \ PS_VALIDATE_SID_FUNC(x); @@ -115,8 +115,8 @@ typedef struct _php_session_rfc1867_progress { zval data; /* the array exported to session data */ zval files; /* data["files"] array */ - zval *post_bytes_processed; /* data["bytes_processed"] */ - zval *current_file_bytes_processed; + zval *post_bytes_processed; /* data["bytes_processed"] */ + zval *current_file_bytes_processed; zval current_file; /* array of currently uploading file */ } php_session_rfc1867_progress; @@ -256,22 +256,22 @@ PHPAPI zend_result php_session_reset_id(void); /* Do not use a return statement in `code` because that may leak memory. * Break out of the loop instead. */ -#define PS_ENCODE_LOOP(code) do { \ - zval _zv; \ - /* protect against user interference */ \ - ZVAL_COPY(&_zv, Z_REFVAL(PS(http_session_vars))); \ +#define PS_ENCODE_LOOP(code) do { \ + zval _zv; \ + /* protect against user interference */ \ + ZVAL_COPY(&_zv, Z_REFVAL(PS(http_session_vars))); \ ZEND_HASH_FOREACH_KEY(Z_ARRVAL(_zv), zend_ulong num_key, zend_string * key) { \ - if (key == NULL) { \ - php_error_docref(NULL, E_WARNING, \ - "Skipping numeric key " ZEND_LONG_FMT, num_key);\ - continue; \ - } \ - zval *struc = php_get_session_var(key); \ - if (struc) { \ - code; \ - } \ - } ZEND_HASH_FOREACH_END(); \ - zval_ptr_dtor(&_zv); \ + if (key == NULL) { \ + php_error_docref(NULL, E_WARNING, \ + "Skipping numeric key " ZEND_LONG_FMT, num_key); \ + continue; \ + } \ + zval *struc = php_get_session_var(key); \ + if (struc) { \ + code; \ + } \ + } ZEND_HASH_FOREACH_END(); \ + zval_ptr_dtor(&_zv); \ } while(0) PHPAPI ZEND_EXTERN_MODULE_GLOBALS(ps) diff --git a/ext/session/session.c b/ext/session/session.c index 0d5f49fd7dd..9ce808ea239 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -83,16 +83,16 @@ zend_class_entry *php_session_update_timestamp_iface_entry; #define IF_SESSION_VARS() \ if (Z_ISREF_P(&PS(http_session_vars)) && Z_TYPE_P(Z_REFVAL(PS(http_session_vars))) == IS_ARRAY) -#define SESSION_CHECK_ACTIVE_STATE \ - if (PS(session_status) == php_session_active) { \ - php_session_session_already_started_error(E_WARNING, "Session ini settings cannot be changed when a session is active"); \ - return FAILURE; \ +#define SESSION_CHECK_ACTIVE_STATE \ + if (PS(session_status) == php_session_active) { \ + php_session_session_already_started_error(E_WARNING, "Session ini settings cannot be changed when a session is active"); \ + return FAILURE; \ } -#define SESSION_CHECK_OUTPUT_STATE \ - if (SG(headers_sent) && stage != ZEND_INI_STAGE_DEACTIVATE) { \ - php_session_headers_already_sent_error(E_WARNING, "Session ini settings cannot be changed after headers have already been sent"); \ - return FAILURE; \ +#define SESSION_CHECK_OUTPUT_STATE \ + if (SG(headers_sent) && stage != ZEND_INI_STAGE_DEACTIVATE) { \ + php_session_headers_already_sent_error(E_WARNING, "Session ini settings cannot be changed after headers have already been sent"); \ + return FAILURE; \ } #define SESSION_FORBIDDEN_CHARS "=,;.[ \t\r\n\013\014" @@ -1408,8 +1408,8 @@ static zend_result php_session_send_cookie(void) smart_str_0(&ncookie); php_session_remove_cookie(); /* remove already sent session ID cookie */ - /* 'replace' must be 0 here, else a previous Set-Cookie - header, probably sent with setcookie() will be replaced! */ + /* 'replace' must be 0 here, else a previous Set-Cookie + header, probably sent with setcookie() will be replaced! */ sapi_add_header_ex(estrndup(ZSTR_VAL(ncookie.s), ZSTR_LEN(ncookie.s)), ZSTR_LEN(ncookie.s), false, false); smart_str_free(&ncookie);