From b71aff4f357e276efa7010a97b61bd1d63cd7fbb Mon Sep 17 00:00:00 2001 From: Stefan Esser Date: Fri, 13 Apr 2012 15:37:11 +0200 Subject: Initial PHP 5.4.0 compatibility --- session.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 2 deletions(-) (limited to 'session.c') diff --git a/session.c b/session.c index f045a36..1045a93 100644 --- a/session.c +++ b/session.c @@ -233,9 +233,94 @@ typedef struct _php_ps_globals_53 { zend_bool invalid_session_id; /* allows the driver to report about an invalid session id and request id regeneration */ } php_ps_globals_53; +#if PHP_VERSION_ID >= 50400 +typedef struct _php_session_rfc1867_progress_54 { + + size_t sname_len; + zval sid; + smart_str key; + + long update_step; + long next_update; + double next_update_time; + zend_bool cancel_upload; + zend_bool apply_trans_sid; + size_t content_length; + + zval *data; /* the array exported to session data */ + zval *post_bytes_processed; /* data["bytes_processed"] */ + zval *files; /* data["files"] array */ + zval *current_file; /* array of currently uploading file */ + zval *current_file_bytes_processed; +} php_session_rfc1867_progress_54; + +typedef struct _php_ps_globals_54 { + char *save_path; + char *session_name; + char *id; + char *extern_referer_chk; + char *entropy_file; + char *cache_limiter; + long entropy_length; + long cookie_lifetime; + char *cookie_path; + char *cookie_domain; + zend_bool cookie_secure; + zend_bool cookie_httponly; + ps_module *mod; + ps_module *default_mod; + void *mod_data; + php_session_status session_status; + long gc_probability; + long gc_divisor; + long gc_maxlifetime; + int module_number; + long cache_expire; + union { + zval *names[6]; + struct { + zval *ps_open; + zval *ps_close; + zval *ps_read; + zval *ps_write; + zval *ps_destroy; + zval *ps_gc; + } name; + } mod_user_names; + int mod_user_implemented; + int mod_user_is_open; + const struct ps_serializer_struct *serializer; + zval *http_session_vars; + zend_bool auto_start; + zend_bool use_cookies; + zend_bool use_only_cookies; + zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */ + zend_bool apply_trans_sid; /* whether or not to enable trans-sid for the current request */ + + long hash_func; +#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) + php_hash_ops *hash_ops; +#endif + long hash_bits_per_character; + int send_cookie; + int define_sid; + zend_bool invalid_session_id; /* allows the driver to report about an invalid session id and request id regeneration */ + + php_session_rfc1867_progress_54 *rfc1867_progress; + zend_bool rfc1867_enabled; /* session.upload_progress.enabled */ + zend_bool rfc1867_cleanup; /* session.upload_progress.cleanup */ + smart_str rfc1867_prefix; /* session.upload_progress.prefix */ + smart_str rfc1867_name; /* session.upload_progress.name */ + long rfc1867_freq; /* session.upload_progress.freq */ + double rfc1867_min_freq; /* session.upload_progress.min_freq */ +} php_ps_globals_54; +#endif + #ifdef ZTS static ts_rsrc_id session_globals_id = 0; -# if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) +# if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) +# define SESSION_G(v) TSRMG(session_globals_id, php_ps_globals_54 *, v) +# elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) # define SESSION_G(v) TSRMG(session_globals_id, php_ps_globals_53 *, v) # elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) # define SESSION_G(v) TSRMG(session_globals_id, php_ps_globals_52 *, v) @@ -247,7 +332,9 @@ static ts_rsrc_id session_globals_id = 0; UNSUPPORTED PHP VERSION # endif #else -# if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) +# if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) +static php_ps_globals_54 *session_globals = NULL; +# elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) static php_ps_globals_53 *session_globals = NULL; # elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) static php_ps_globals_52 *session_globals = NULL; @@ -294,6 +381,7 @@ static int suhosin_get_session_var(char *name, size_t namelen, zval ***state_var if (SESSION_G(http_session_vars) && SESSION_G(http_session_vars)->type == IS_ARRAY) { ret = zend_hash_find(Z_ARRVAL_P(SESSION_G(http_session_vars)), name, namelen + 1, (void **) state_var); +#if PHP_VERSION_ID < 50400 /* If register_globals is enabled, and * if there is an entry for the slot in $_SESSION, and * if that entry is still set to NULL, and @@ -307,6 +395,7 @@ static int suhosin_get_session_var(char *name, size_t namelen, zval ***state_var *state_var = tmp; } } +#endif } return ret; } -- cgit v1.3