diff options
| author | Stefan Esser | 2012-04-13 15:37:11 +0200 |
|---|---|---|
| committer | Stefan Esser | 2012-04-13 15:37:11 +0200 |
| commit | b71aff4f357e276efa7010a97b61bd1d63cd7fbb (patch) | |
| tree | 33087e1f0a3543f83ec006a30ef8f0304f4a77d9 /session.c | |
| parent | 6b00f2346c2529a9169cf1c04580e293a77f6a71 (diff) | |
Initial PHP 5.4.0 compatibility
Diffstat (limited to 'session.c')
| -rw-r--r-- | session.c | 93 |
1 files changed, 91 insertions, 2 deletions
| @@ -233,9 +233,94 @@ typedef struct _php_ps_globals_53 { | |||
| 233 | zend_bool invalid_session_id; /* allows the driver to report about an invalid session id and request id regeneration */ | 233 | zend_bool invalid_session_id; /* allows the driver to report about an invalid session id and request id regeneration */ |
| 234 | } php_ps_globals_53; | 234 | } php_ps_globals_53; |
| 235 | 235 | ||
| 236 | #if PHP_VERSION_ID >= 50400 | ||
| 237 | typedef struct _php_session_rfc1867_progress_54 { | ||
| 238 | |||
| 239 | size_t sname_len; | ||
| 240 | zval sid; | ||
| 241 | smart_str key; | ||
| 242 | |||
| 243 | long update_step; | ||
| 244 | long next_update; | ||
| 245 | double next_update_time; | ||
| 246 | zend_bool cancel_upload; | ||
| 247 | zend_bool apply_trans_sid; | ||
| 248 | size_t content_length; | ||
| 249 | |||
| 250 | zval *data; /* the array exported to session data */ | ||
| 251 | zval *post_bytes_processed; /* data["bytes_processed"] */ | ||
| 252 | zval *files; /* data["files"] array */ | ||
| 253 | zval *current_file; /* array of currently uploading file */ | ||
| 254 | zval *current_file_bytes_processed; | ||
| 255 | } php_session_rfc1867_progress_54; | ||
| 256 | |||
| 257 | typedef struct _php_ps_globals_54 { | ||
| 258 | char *save_path; | ||
| 259 | char *session_name; | ||
| 260 | char *id; | ||
| 261 | char *extern_referer_chk; | ||
| 262 | char *entropy_file; | ||
| 263 | char *cache_limiter; | ||
| 264 | long entropy_length; | ||
| 265 | long cookie_lifetime; | ||
| 266 | char *cookie_path; | ||
| 267 | char *cookie_domain; | ||
| 268 | zend_bool cookie_secure; | ||
| 269 | zend_bool cookie_httponly; | ||
| 270 | ps_module *mod; | ||
| 271 | ps_module *default_mod; | ||
| 272 | void *mod_data; | ||
| 273 | php_session_status session_status; | ||
| 274 | long gc_probability; | ||
| 275 | long gc_divisor; | ||
| 276 | long gc_maxlifetime; | ||
| 277 | int module_number; | ||
| 278 | long cache_expire; | ||
| 279 | union { | ||
| 280 | zval *names[6]; | ||
| 281 | struct { | ||
| 282 | zval *ps_open; | ||
| 283 | zval *ps_close; | ||
| 284 | zval *ps_read; | ||
| 285 | zval *ps_write; | ||
| 286 | zval *ps_destroy; | ||
| 287 | zval *ps_gc; | ||
| 288 | } name; | ||
| 289 | } mod_user_names; | ||
| 290 | int mod_user_implemented; | ||
| 291 | int mod_user_is_open; | ||
| 292 | const struct ps_serializer_struct *serializer; | ||
| 293 | zval *http_session_vars; | ||
| 294 | zend_bool auto_start; | ||
| 295 | zend_bool use_cookies; | ||
| 296 | zend_bool use_only_cookies; | ||
| 297 | zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */ | ||
| 298 | zend_bool apply_trans_sid; /* whether or not to enable trans-sid for the current request */ | ||
| 299 | |||
| 300 | long hash_func; | ||
| 301 | #if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) | ||
| 302 | php_hash_ops *hash_ops; | ||
| 303 | #endif | ||
| 304 | long hash_bits_per_character; | ||
| 305 | int send_cookie; | ||
| 306 | int define_sid; | ||
| 307 | zend_bool invalid_session_id; /* allows the driver to report about an invalid session id and request id regeneration */ | ||
| 308 | |||
| 309 | php_session_rfc1867_progress_54 *rfc1867_progress; | ||
| 310 | zend_bool rfc1867_enabled; /* session.upload_progress.enabled */ | ||
| 311 | zend_bool rfc1867_cleanup; /* session.upload_progress.cleanup */ | ||
| 312 | smart_str rfc1867_prefix; /* session.upload_progress.prefix */ | ||
| 313 | smart_str rfc1867_name; /* session.upload_progress.name */ | ||
| 314 | long rfc1867_freq; /* session.upload_progress.freq */ | ||
| 315 | double rfc1867_min_freq; /* session.upload_progress.min_freq */ | ||
| 316 | } php_ps_globals_54; | ||
| 317 | #endif | ||
| 318 | |||
| 236 | #ifdef ZTS | 319 | #ifdef ZTS |
| 237 | static ts_rsrc_id session_globals_id = 0; | 320 | static ts_rsrc_id session_globals_id = 0; |
| 238 | # if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) | 321 | # if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) |
| 322 | # define SESSION_G(v) TSRMG(session_globals_id, php_ps_globals_54 *, v) | ||
| 323 | # elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) | ||
| 239 | # define SESSION_G(v) TSRMG(session_globals_id, php_ps_globals_53 *, v) | 324 | # define SESSION_G(v) TSRMG(session_globals_id, php_ps_globals_53 *, v) |
| 240 | # elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) | 325 | # elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) |
| 241 | # define SESSION_G(v) TSRMG(session_globals_id, php_ps_globals_52 *, v) | 326 | # 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; | |||
| 247 | UNSUPPORTED PHP VERSION | 332 | UNSUPPORTED PHP VERSION |
| 248 | # endif | 333 | # endif |
| 249 | #else | 334 | #else |
| 250 | # if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) | 335 | # if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) |
| 336 | static php_ps_globals_54 *session_globals = NULL; | ||
| 337 | # elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) | ||
| 251 | static php_ps_globals_53 *session_globals = NULL; | 338 | static php_ps_globals_53 *session_globals = NULL; |
| 252 | # elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) | 339 | # elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) |
| 253 | static php_ps_globals_52 *session_globals = NULL; | 340 | 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 | |||
| 294 | if (SESSION_G(http_session_vars) && SESSION_G(http_session_vars)->type == IS_ARRAY) { | 381 | if (SESSION_G(http_session_vars) && SESSION_G(http_session_vars)->type == IS_ARRAY) { |
| 295 | ret = zend_hash_find(Z_ARRVAL_P(SESSION_G(http_session_vars)), name, namelen + 1, (void **) state_var); | 382 | ret = zend_hash_find(Z_ARRVAL_P(SESSION_G(http_session_vars)), name, namelen + 1, (void **) state_var); |
| 296 | 383 | ||
| 384 | #if PHP_VERSION_ID < 50400 | ||
| 297 | /* If register_globals is enabled, and | 385 | /* If register_globals is enabled, and |
| 298 | * if there is an entry for the slot in $_SESSION, and | 386 | * if there is an entry for the slot in $_SESSION, and |
| 299 | * if that entry is still set to NULL, and | 387 | * 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 | |||
| 307 | *state_var = tmp; | 395 | *state_var = tmp; |
| 308 | } | 396 | } |
| 309 | } | 397 | } |
| 398 | #endif | ||
| 310 | } | 399 | } |
| 311 | return ret; | 400 | return ret; |
| 312 | } | 401 | } |
