Commit 8926dc0140e for php.net
commit 8926dc0140ea7a46901aa7dae6b54b47c59cc7ea
Author: Gina Peter Banyard <girgias@php.net>
Date: Fri Feb 6 13:14:32 2026 +0000
ext/session: refactor session_reset()
By making the underlying function return a bool and not do duplicate checks
diff --git a/ext/session/session.c b/ext/session/session.c
index aa155414b91..260e5533771 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1747,13 +1747,13 @@ static bool php_session_abort(void)
return false;
}
-static zend_result php_session_reset(void)
+static bool php_session_reset(void)
{
if (PS(session_status) == php_session_active
&& php_session_initialize() == SUCCESS) {
- return SUCCESS;
+ return true;
}
- return FAILURE;
+ return false;
}
@@ -2748,11 +2748,7 @@ PHP_FUNCTION(session_reset)
RETURN_THROWS();
}
- if (PS(session_status) != php_session_active) {
- RETURN_FALSE;
- }
- php_session_reset();
- RETURN_TRUE;
+ RETURN_BOOL(php_session_reset());
}
PHP_FUNCTION(session_status)