mirror of
https://github.com/php/php-src.git
synced 2024-12-02 06:13:40 +08:00
Added session_is_registered(varname) function.
This commit is contained in:
parent
17f725d21a
commit
a6aacfd2b6
@ -96,6 +96,7 @@ PHP_FUNCTION(session_id);
|
||||
PHP_FUNCTION(session_decode);
|
||||
PHP_FUNCTION(session_register);
|
||||
PHP_FUNCTION(session_unregister);
|
||||
PHP_FUNCTION(session_is_registered);
|
||||
PHP_FUNCTION(session_encode);
|
||||
PHP_FUNCTION(session_start);
|
||||
PHP_FUNCTION(session_destroy);
|
||||
|
@ -65,6 +65,7 @@ function_entry session_functions[] = {
|
||||
PHP_FE(session_decode, NULL)
|
||||
PHP_FE(session_register, NULL)
|
||||
PHP_FE(session_unregister, NULL)
|
||||
PHP_FE(session_is_registered, NULL)
|
||||
PHP_FE(session_encode, NULL)
|
||||
PHP_FE(session_start, NULL)
|
||||
PHP_FE(session_destroy, NULL)
|
||||
@ -473,6 +474,32 @@ PHP_FUNCTION(session_unregister)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool session_is_registered(string varname)
|
||||
checks if a variable is registered in session */
|
||||
PHP_FUNCTION(session_is_registered)
|
||||
{
|
||||
pval *p_name;
|
||||
pval *p_var;
|
||||
int ac = ARG_COUNT(ht);
|
||||
PSLS_FETCH();
|
||||
|
||||
if(ac != 1 || getParameters(ht, ac, &p_name) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string(p_name);
|
||||
|
||||
if (zend_hash_find(&PS(vars), p_name->value.str.val, p_name->value.str.len+1,
|
||||
(void **)&p_var) == SUCCESS) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto string session_encode()
|
||||
serializes the current setup and returns the serialized representation */
|
||||
PHP_FUNCTION(session_encode)
|
||||
|
Loading…
Reference in New Issue
Block a user