Skip to content

Commit 8926dc0

Browse files
committed
ext/session: refactor session_reset()
By making the underlying function return a bool and not do duplicate checks
1 parent a9496bd commit 8926dc0

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

ext/session/session.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,13 +1747,13 @@ static bool php_session_abort(void)
17471747
return false;
17481748
}
17491749

1750-
static zend_result php_session_reset(void)
1750+
static bool php_session_reset(void)
17511751
{
17521752
if (PS(session_status) == php_session_active
17531753
&& php_session_initialize() == SUCCESS) {
1754-
return SUCCESS;
1754+
return true;
17551755
}
1756-
return FAILURE;
1756+
return false;
17571757
}
17581758

17591759

@@ -2748,11 +2748,7 @@ PHP_FUNCTION(session_reset)
27482748
RETURN_THROWS();
27492749
}
27502750

2751-
if (PS(session_status) != php_session_active) {
2752-
RETURN_FALSE;
2753-
}
2754-
php_session_reset();
2755-
RETURN_TRUE;
2751+
RETURN_BOOL(php_session_reset());
27562752
}
27572753

27582754
PHP_FUNCTION(session_status)

0 commit comments

Comments
 (0)