php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79587 SessionHandler::destroy() works only once
Submitted: 2020-05-11 16:12 UTC Modified: 2020-05-12 14:45 UTC
From: sharkykz at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Session related
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sharkykz at gmail dot com
New email:
PHP Version: OS:

 

 [2020-05-11 16:12 UTC] sharkykz at gmail dot com
Description:
------------
Calling SessionHandler::destroy() multiple times destroys only first session.

Test script:
---------------
// Basic setup.
$handler = new \SessionHandler;
session_set_save_handler($handler);
session_start();

// Array of session IDs.
$sessionsToDestroy = array(
	'sessionId1',
	'sessionId2',
	'sessionId3',
);

// Attempt to destroy the sessions.
foreach ($sessionsToDestroy as $sessionId)
{
	$handler->destroy($sessionId);
}

Expected result:
----------------
All passed sessions destroyed.

Actual result:
--------------
Only the first session is destroyed.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-12 14:45 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-05-12 14:45 UTC] cmb@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

From the PHP manual[1]:

| Please note the callback methods of this class are designed to
| be called internally by PHP and are not meant to be called from
| user-space code. The return values are equally processed
| internally by PHP.

[1] <https://www.php.net/SessionHandler>
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 08 17:01:35 2025 UTC