mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/session: refactor session_write_close()
By making the underlying function return a bool and not do duplicate checks
This commit is contained in:
@@ -97,6 +97,9 @@ PHP 8.6 INTERNALS UPGRADE NOTES
|
||||
. Dropped session_options parameter from all methods in mysqlnd_auth.
|
||||
The same information is present in conn->options and should be used instead.
|
||||
|
||||
- ext/session:
|
||||
. php_session_flush() now returns a bool rather than a zend_result.
|
||||
|
||||
- ext/standard:
|
||||
. _php_error_log() now has a formal return type of zend_result.
|
||||
. _php_error_log() now accepts zend_string* values instead of char*.
|
||||
|
||||
@@ -263,7 +263,7 @@ PHPAPI zend_result php_session_register_serializer(const char *name,
|
||||
zend_result (*decode)(PS_SERIALIZER_DECODE_ARGS));
|
||||
|
||||
PHPAPI zend_result php_session_start(void);
|
||||
PHPAPI zend_result php_session_flush(bool write);
|
||||
PHPAPI bool php_session_flush(bool write);
|
||||
PHPAPI php_session_status php_get_session_status(void);
|
||||
|
||||
PHPAPI const ps_module *_php_find_ps_module(const char *name);
|
||||
|
||||
@@ -1720,14 +1720,14 @@ PHPAPI zend_result php_session_start(void)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHPAPI zend_result php_session_flush(bool write)
|
||||
PHPAPI bool php_session_flush(bool write)
|
||||
{
|
||||
if (PS(session_status) == php_session_active) {
|
||||
php_session_save_current_state(write);
|
||||
PS(session_status) = php_session_none;
|
||||
return SUCCESS;
|
||||
return true;
|
||||
}
|
||||
return FAILURE;
|
||||
return false;
|
||||
}
|
||||
|
||||
PHPAPI php_session_status php_get_session_status(void)
|
||||
@@ -2724,11 +2724,7 @@ PHP_FUNCTION(session_write_close)
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (PS(session_status) != php_session_active) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
php_session_flush(true);
|
||||
RETURN_TRUE;
|
||||
RETURN_BOOL(php_session_flush(true));
|
||||
}
|
||||
|
||||
/* Abort session and end session. Session data will not be written */
|
||||
|
||||
Reference in New Issue
Block a user