php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_session.h File Reference

Go to the source code of this file.

Data Structures

struct  ps_module_struct
 
struct  _php_session_rfc1867_progress
 
struct  _php_ps_globals
 
struct  ps_serializer_struct
 

Macros

#define PHP_SESSION_API   20161017
 
#define PHP_SESSION_VERSION   PHP_VERSION
 
#define PS_OPEN_ARGS   void **mod_data, const char *save_path, const char *session_name
 
#define PS_CLOSE_ARGS   void **mod_data
 
#define PS_READ_ARGS   void **mod_data, zend_string *key, zend_string **val, zend_long maxlifetime
 
#define PS_WRITE_ARGS   void **mod_data, zend_string *key, zend_string *val, zend_long maxlifetime
 
#define PS_DESTROY_ARGS   void **mod_data, zend_string *key
 
#define PS_GC_ARGS   void **mod_data, zend_long maxlifetime, zend_long *nrdels
 
#define PS_CREATE_SID_ARGS   void **mod_data
 
#define PS_VALIDATE_SID_ARGS   void **mod_data, zend_string *key
 
#define PS_UPDATE_TIMESTAMP_ARGS   void **mod_data, zend_string *key, zend_string *val, zend_long maxlifetime
 
#define PS_GET_MOD_DATA()
 
#define PS_SET_MOD_DATA(a)
 
#define PS_OPEN_FUNC(x)
 
#define PS_CLOSE_FUNC(x)
 
#define PS_READ_FUNC(x)
 
#define PS_WRITE_FUNC(x)
 
#define PS_DESTROY_FUNC(x)
 
#define PS_GC_FUNC(x)
 
#define PS_CREATE_SID_FUNC(x)
 
#define PS_VALIDATE_SID_FUNC(x)
 
#define PS_UPDATE_TIMESTAMP_FUNC(x)
 
#define PS_FUNCS(x)
 
#define PS_MOD(x)
 
#define PS_FUNCS_SID(x)
 
#define PS_MOD_SID(x)
 
#define PS_FUNCS_UPDATE_TIMESTAMP(x)
 
#define PS_MOD_UPDATE_TIMESTAMP(x)
 
#define phpext_session_ptr   &session_module_entry
 
#define PS(v)
 
#define PS_SERIALIZER_ENCODE_ARGS   void
 
#define PS_SERIALIZER_DECODE_ARGS   const char *val, size_t vallen
 
#define PS_SERIALIZER_ENCODE_NAME(x)
 
#define PS_SERIALIZER_DECODE_NAME(x)
 
#define PS_SERIALIZER_ENCODE_FUNC(x)
 
#define PS_SERIALIZER_DECODE_FUNC(x)
 
#define PS_SERIALIZER_FUNCS(x)
 
#define PS_SERIALIZER_ENTRY(x)
 
#define PS_ADD_VARL(name)
 
#define PS_ADD_VAR(name)
 
#define PS_DEL_VARL(name)
 
#define PS_ENCODE_VARS
 
#define PS_ENCODE_LOOP(code)
 

Typedefs

typedef struct ps_module_struct ps_module
 
typedef struct _php_session_rfc1867_progress php_session_rfc1867_progress
 
typedef struct _php_ps_globals php_ps_globals
 
typedef php_ps_globals zend_ps_globals
 
typedef struct ps_serializer_struct ps_serializer
 

Enumerations

enum  php_session_status { php_session_disabled , php_session_none , php_session_active }
 

Functions

PHPAPI zend_stringphp_session_create_id (PS_CREATE_SID_ARGS)
 
PHPAPI zend_result php_session_validate_sid (PS_VALIDATE_SID_ARGS)
 
PHPAPI zend_result php_session_update_timestamp (PS_UPDATE_TIMESTAMP_ARGS)
 
PHPAPI void session_adapt_url (const char *url, size_t url_len, char **new_url, size_t *new_len)
 
PHPAPI zend_result php_session_destroy (void)
 
PHPAPI void php_add_session_var (zend_string *name)
 
PHPAPI zvalphp_set_session_var (zend_string *name, zval *state_val, php_unserialize_data_t *var_hash)
 
PHPAPI zvalphp_get_session_var (zend_string *name)
 
PHPAPI zvalphp_get_session_var_str (const char *name, size_t name_len)
 
PHPAPI zend_result php_session_register_module (const ps_module *)
 
PHPAPI zend_result php_session_register_serializer (const char *name, zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS), zend_result(*decode)(PS_SERIALIZER_DECODE_ARGS))
 
PHPAPI zend_result php_session_start (void)
 
PHPAPI zend_result php_session_flush (int write)
 
PHPAPI php_session_status php_get_session_status (void)
 
PHPAPI const ps_module_php_find_ps_module (const char *name)
 
PHPAPI const ps_serializer_php_find_ps_serializer (const char *name)
 
PHPAPI zend_result php_session_valid_key (const char *key)
 
PHPAPI zend_result php_session_reset_id (void)
 
PHPAPI ZEND_EXTERN_MODULE_GLOBALS (ps) void php_session_auto_start(void *data)
 
 PHP_METHOD (SessionHandler, open)
 
 PHP_METHOD (SessionHandler, close)
 
 PHP_METHOD (SessionHandler, read)
 
 PHP_METHOD (SessionHandler, write)
 
 PHP_METHOD (SessionHandler, destroy)
 
 PHP_METHOD (SessionHandler, gc)
 
 PHP_METHOD (SessionHandler, create_sid)
 

Variables

zend_module_entry session_module_entry
 
PHPAPI zend_class_entryphp_session_class_entry
 
PHPAPI zend_class_entryphp_session_iface_entry
 
PHPAPI zend_class_entryphp_session_id_iface_entry
 
PHPAPI zend_class_entryphp_session_update_timestamp_iface_entry
 

Macro Definition Documentation

◆ PHP_SESSION_API

#define PHP_SESSION_API   20161017

Definition at line 23 of file php_session.h.

◆ PHP_SESSION_VERSION

#define PHP_SESSION_VERSION   PHP_VERSION

Definition at line 26 of file php_session.h.

◆ phpext_session_ptr

#define phpext_session_ptr   &session_module_entry

Definition at line 211 of file php_session.h.

◆ PS

#define PS ( v)
Value:
(ps_globals.v)

Definition at line 219 of file php_session.h.

◆ PS_ADD_VAR

#define PS_ADD_VAR ( name)
Value:
#define PS_ADD_VARL(name)
zend_string * name

Definition at line 280 of file php_session.h.

◆ PS_ADD_VARL

#define PS_ADD_VARL ( name)
Value:
do { \
php_add_session_var(name); \
} while (0)

Definition at line 276 of file php_session.h.

◆ PS_CLOSE_ARGS

#define PS_CLOSE_ARGS   void **mod_data

Definition at line 30 of file php_session.h.

◆ PS_CLOSE_FUNC

#define PS_CLOSE_FUNC ( x)
Value:
#define PS_CLOSE_ARGS
Definition php_session.h:30
ZEND_RESULT_CODE zend_result
Definition zend_types.h:64

Definition at line 56 of file php_session.h.

◆ PS_CREATE_SID_ARGS

#define PS_CREATE_SID_ARGS   void **mod_data

Definition at line 35 of file php_session.h.

◆ PS_CREATE_SID_FUNC

#define PS_CREATE_SID_FUNC ( x)
Value:
zend_string *ps_create_sid_##x(PS_CREATE_SID_ARGS)
#define PS_CREATE_SID_ARGS
Definition php_session.h:35
struct _zend_string zend_string

Definition at line 61 of file php_session.h.

◆ PS_DEL_VARL

#define PS_DEL_VARL ( name)
Value:
do { \
if (!Z_ISNULL(PS(http_session_vars))) { \
zend_hash_del(Z_ARRVAL(PS(http_session_vars)), name); \
} \
} while (0)
#define PS(v)
#define Z_ISNULL(zval)
Definition zend_types.h:959
#define Z_ARRVAL(zval)
Definition zend_types.h:986

Definition at line 282 of file php_session.h.

◆ PS_DESTROY_ARGS

#define PS_DESTROY_ARGS   void **mod_data, zend_string *key

Definition at line 33 of file php_session.h.

◆ PS_DESTROY_FUNC

#define PS_DESTROY_FUNC ( x)
Value:
#define PS_DESTROY_ARGS
Definition php_session.h:33

Definition at line 59 of file php_session.h.

◆ PS_ENCODE_LOOP

#define PS_ENCODE_LOOP ( code)
Value:
do { \
zval _zv; \
/* protect against user interference */ \
ZVAL_COPY(&_zv, Z_REFVAL(PS(http_session_vars))); \
HashTable *_ht = Z_ARRVAL(_zv); \
ZEND_HASH_FOREACH_KEY(_ht, num_key, key) { \
if (key == NULL) { \
php_error_docref(NULL, E_WARNING, \
"Skipping numeric key " ZEND_LONG_FMT, num_key);\
continue; \
} \
if ((struc = php_get_session_var(key))) { \
code; \
} \
zval_ptr_dtor(&_zv); \
} while(0)
#define NULL
Definition gdcache.h:45
unsigned char key[REFLECTION_KEY_LEN]
PHPAPI zval * php_get_session_var(zend_string *name)
Definition session.c:219
struct _zval_struct zval
#define E_WARNING
Definition zend_errors.h:24
#define ZEND_HASH_FOREACH_END()
Definition zend_hash.h:1086
#define ZEND_LONG_FMT
Definition zend_long.h:87
struct _zend_array HashTable
Definition zend_types.h:386
#define Z_REFVAL(zval)

Definition at line 296 of file php_session.h.

◆ PS_ENCODE_VARS

#define PS_ENCODE_VARS
Value:
zend_ulong num_key; \
zval *struc;
uint32_t zend_ulong
Definition zend_long.h:43

Definition at line 289 of file php_session.h.

◆ PS_FUNCS

#define PS_FUNCS ( x)
Value:
PS_CLOSE_FUNC(x); \
PS_READ_FUNC(x); \
PS_WRITE_FUNC(x); \
PS_DESTROY_FUNC(x); \
PS_GC_FUNC(x); \
PS_CREATE_SID_FUNC(x)
#define PS_OPEN_FUNC(x)
Definition php_session.h:55

Definition at line 66 of file php_session.h.

◆ PS_FUNCS_SID

#define PS_FUNCS_SID ( x)
Value:
PS_CLOSE_FUNC(x); \
PS_READ_FUNC(x); \
PS_WRITE_FUNC(x); \
PS_DESTROY_FUNC(x); \
PS_GC_FUNC(x); \
PS_CREATE_SID_FUNC(x); \
PS_VALIDATE_SID_FUNC(x); \
PS_UPDATE_TIMESTAMP_FUNC(x);

Definition at line 81 of file php_session.h.

◆ PS_FUNCS_UPDATE_TIMESTAMP

#define PS_FUNCS_UPDATE_TIMESTAMP ( x)
Value:
PS_CLOSE_FUNC(x); \
PS_READ_FUNC(x); \
PS_WRITE_FUNC(x); \
PS_DESTROY_FUNC(x); \
PS_GC_FUNC(x); \
PS_CREATE_SID_FUNC(x); \
PS_VALIDATE_SID_FUNC(x); \
PS_UPDATE_TIMESTAMP_FUNC(x);

Definition at line 99 of file php_session.h.

◆ PS_GC_ARGS

#define PS_GC_ARGS   void **mod_data, zend_long maxlifetime, zend_long *nrdels

Definition at line 34 of file php_session.h.

◆ PS_GC_FUNC

#define PS_GC_FUNC ( x)
Value:
#define PS_GC_ARGS
Definition php_session.h:34
int32_t zend_long
Definition zend_long.h:42

Definition at line 60 of file php_session.h.

◆ PS_GET_MOD_DATA

#define PS_GET_MOD_DATA ( )
Value:
*mod_data

Definition at line 52 of file php_session.h.

◆ PS_MOD

#define PS_MOD ( x)
Value:
#x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
ps_delete_##x, ps_gc_##x, php_session_create_id, \
php_session_validate_sid, php_session_update_timestamp

Definition at line 75 of file php_session.h.

◆ PS_MOD_SID

#define PS_MOD_SID ( x)
Value:
#x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
ps_delete_##x, ps_gc_##x, ps_create_sid_##x, \
php_session_validate_sid, php_session_update_timestamp

Definition at line 92 of file php_session.h.

◆ PS_MOD_UPDATE_TIMESTAMP

#define PS_MOD_UPDATE_TIMESTAMP ( x)
Value:
#x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
ps_delete_##x, ps_gc_##x, ps_create_sid_##x, \
ps_validate_sid_##x, ps_update_timestamp_##x

Definition at line 110 of file php_session.h.

◆ PS_OPEN_ARGS

#define PS_OPEN_ARGS   void **mod_data, const char *save_path, const char *session_name

Definition at line 29 of file php_session.h.

◆ PS_OPEN_FUNC

#define PS_OPEN_FUNC ( x)
Value:
#define PS_OPEN_ARGS
Definition php_session.h:29

Definition at line 55 of file php_session.h.

◆ PS_READ_ARGS

#define PS_READ_ARGS   void **mod_data, zend_string *key, zend_string **val, zend_long maxlifetime

Definition at line 31 of file php_session.h.

◆ PS_READ_FUNC

#define PS_READ_FUNC ( x)
Value:
#define PS_READ_ARGS
Definition php_session.h:31

Definition at line 57 of file php_session.h.

◆ PS_SERIALIZER_DECODE_ARGS

#define PS_SERIALIZER_DECODE_ARGS   const char *val, size_t vallen

Definition at line 223 of file php_session.h.

◆ PS_SERIALIZER_DECODE_FUNC

#define PS_SERIALIZER_DECODE_FUNC ( x)
Value:
#define PS_SERIALIZER_DECODE_ARGS
#define PS_SERIALIZER_DECODE_NAME(x)

Definition at line 236 of file php_session.h.

◆ PS_SERIALIZER_DECODE_NAME

#define PS_SERIALIZER_DECODE_NAME ( x)
Value:
ps_srlzr_decode_##x

Definition at line 232 of file php_session.h.

◆ PS_SERIALIZER_ENCODE_ARGS

#define PS_SERIALIZER_ENCODE_ARGS   void

Definition at line 222 of file php_session.h.

◆ PS_SERIALIZER_ENCODE_FUNC

#define PS_SERIALIZER_ENCODE_FUNC ( x)
Value:
#define PS_SERIALIZER_ENCODE_NAME(x)
#define PS_SERIALIZER_ENCODE_ARGS

Definition at line 234 of file php_session.h.

◆ PS_SERIALIZER_ENCODE_NAME

#define PS_SERIALIZER_ENCODE_NAME ( x)
Value:
ps_srlzr_encode_##x

Definition at line 231 of file php_session.h.

◆ PS_SERIALIZER_ENTRY

#define PS_SERIALIZER_ENTRY ( x)
Value:

Definition at line 243 of file php_session.h.

◆ PS_SERIALIZER_FUNCS

#define PS_SERIALIZER_FUNCS ( x)
Value:
PS_SERIALIZER_DECODE_FUNC(x)
#define PS_SERIALIZER_ENCODE_FUNC(x)

Definition at line 239 of file php_session.h.

◆ PS_SET_MOD_DATA

#define PS_SET_MOD_DATA ( a)
Value:
*mod_data = (a)
$obj a
Definition test.php:84

Definition at line 53 of file php_session.h.

◆ PS_UPDATE_TIMESTAMP_ARGS

#define PS_UPDATE_TIMESTAMP_ARGS   void **mod_data, zend_string *key, zend_string *val, zend_long maxlifetime

Definition at line 37 of file php_session.h.

◆ PS_UPDATE_TIMESTAMP_FUNC

#define PS_UPDATE_TIMESTAMP_FUNC ( x)
Value:
zend_result ps_update_timestamp_##x(PS_UPDATE_TIMESTAMP_ARGS)
#define PS_UPDATE_TIMESTAMP_ARGS
Definition php_session.h:37

Definition at line 63 of file php_session.h.

◆ PS_VALIDATE_SID_ARGS

#define PS_VALIDATE_SID_ARGS   void **mod_data, zend_string *key

Definition at line 36 of file php_session.h.

◆ PS_VALIDATE_SID_FUNC

#define PS_VALIDATE_SID_FUNC ( x)
Value:
zend_result ps_validate_sid_##x(PS_VALIDATE_SID_ARGS)
#define PS_VALIDATE_SID_ARGS
Definition php_session.h:36

Definition at line 62 of file php_session.h.

◆ PS_WRITE_ARGS

#define PS_WRITE_ARGS   void **mod_data, zend_string *key, zend_string *val, zend_long maxlifetime

Definition at line 32 of file php_session.h.

◆ PS_WRITE_FUNC

#define PS_WRITE_FUNC ( x)
Value:
#define PS_WRITE_ARGS
Definition php_session.h:32

Definition at line 58 of file php_session.h.

Typedef Documentation

◆ php_ps_globals

◆ php_session_rfc1867_progress

◆ ps_module

typedef struct ps_module_struct ps_module

◆ ps_serializer

◆ zend_ps_globals

Definition at line 208 of file php_session.h.

Enumeration Type Documentation

◆ php_session_status

Enumerator
php_session_disabled 
php_session_none 
php_session_active 

Definition at line 116 of file php_session.h.

Function Documentation

◆ _php_find_ps_module()

PHPAPI const ps_module * _php_find_ps_module ( const char * name)

Definition at line 1495 of file session.c.

◆ _php_find_ps_serializer()

PHPAPI const ps_serializer * _php_find_ps_serializer ( const char * name)

Definition at line 1511 of file session.c.

◆ php_add_session_var()

PHPAPI void php_add_session_var ( zend_string * name)

Definition at line 194 of file session.c.

◆ php_get_session_status()

PHPAPI php_session_status php_get_session_status ( void )

Definition at line 1738 of file session.c.

◆ php_get_session_var()

PHPAPI zval * php_get_session_var ( zend_string * name)

Definition at line 219 of file session.c.

◆ php_get_session_var_str()

PHPAPI zval * php_get_session_var_str ( const char * name,
size_t name_len )

Definition at line 228 of file session.c.

◆ PHP_METHOD() [1/7]

PHP_METHOD ( SessionHandler ,
close  )
extern

Definition at line 66 of file mod_user_class.c.

◆ PHP_METHOD() [2/7]

PHP_METHOD ( SessionHandler ,
create_sid  )
extern

Definition at line 159 of file mod_user_class.c.

◆ PHP_METHOD() [3/7]

PHP_METHOD ( SessionHandler ,
destroy  )
extern

Definition at line 125 of file mod_user_class.c.

◆ PHP_METHOD() [4/7]

PHP_METHOD ( SessionHandler ,
gc  )
extern

Definition at line 140 of file mod_user_class.c.

◆ PHP_METHOD() [5/7]

PHP_METHOD ( SessionHandler ,
open  )
extern

Definition at line 38 of file mod_user_class.c.

◆ PHP_METHOD() [6/7]

PHP_METHOD ( SessionHandler ,
read  )
extern

Definition at line 90 of file mod_user_class.c.

◆ PHP_METHOD() [7/7]

PHP_METHOD ( SessionHandler ,
write  )
extern

Definition at line 110 of file mod_user_class.c.

◆ php_session_create_id()

PHPAPI zend_string * php_session_create_id ( PS_CREATE_SID_ARGS )

Definition at line 335 of file session.c.

◆ php_session_destroy()

PHPAPI zend_result php_session_destroy ( void )

Definition at line 171 of file session.c.

◆ php_session_flush()

PHPAPI zend_result php_session_flush ( int write)

Definition at line 1727 of file session.c.

◆ php_session_register_module()

PHPAPI zend_result php_session_register_module ( const ps_module * ptr)

Definition at line 1181 of file session.c.

◆ php_session_register_serializer()

PHPAPI zend_result php_session_register_serializer ( const char * name,
zend_string *(* encode )(PS_SERIALIZER_ENCODE_ARGS),
zend_result(* decode )(PS_SERIALIZER_DECODE_ARGS) )

Definition at line 1151 of file session.c.

◆ php_session_reset_id()

PHPAPI zend_result php_session_reset_id ( void )

Definition at line 1538 of file session.c.

◆ php_session_start()

PHPAPI zend_result php_session_start ( void )

Definition at line 1611 of file session.c.

◆ php_session_update_timestamp()

PHPAPI zend_result php_session_update_timestamp ( PS_UPDATE_TIMESTAMP_ARGS )

Definition at line 1204 of file session.c.

◆ php_session_valid_key()

PHPAPI zend_result php_session_valid_key ( const char * key)

Definition at line 359 of file session.c.

◆ php_session_validate_sid()

PHPAPI zend_result php_session_validate_sid ( PS_VALIDATE_SID_ARGS )

Definition at line 1199 of file session.c.

◆ php_set_session_var()

PHPAPI zval * php_set_session_var ( zend_string * name,
zval * state_val,
php_unserialize_data_t * var_hash )

Definition at line 208 of file session.c.

◆ session_adapt_url()

PHPAPI void session_adapt_url ( const char * url,
size_t url_len,
char ** new_url,
size_t * new_len )

Definition at line 1770 of file session.c.

◆ ZEND_EXTERN_MODULE_GLOBALS()

PHPAPI ZEND_EXTERN_MODULE_GLOBALS ( ps )

Variable Documentation

◆ php_session_class_entry

PHPAPI zend_class_entry* php_session_class_entry
extern

◆ php_session_id_iface_entry

PHPAPI zend_class_entry* php_session_id_iface_entry
extern

◆ php_session_iface_entry

PHPAPI zend_class_entry* php_session_iface_entry
extern

◆ php_session_update_timestamp_iface_entry

PHPAPI zend_class_entry* php_session_update_timestamp_iface_entry
extern

◆ session_module_entry

zend_module_entry session_module_entry
extern

Definition at line 3392 of file session.c.