diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 27414f52b37..60615cb67ba 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -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*. diff --git a/ext/session/php_session.h b/ext/session/php_session.h index ace8c6998cd..bf6fcbdcf49 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -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); diff --git a/ext/session/session.c b/ext/session/session.c index 260e5533771..92ed91fbf86 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -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 */