|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73394 php_session_initialize doesn't verify s_read return value
Submitted: 2016-10-26 16:13 UTC Modified: 2021-03-28 04:22 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: martijn at openbsd dot org Assigned: cmb (profile)
Status: No Feedback Package: Session related
PHP Version: 7.0.12 OS: irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-10-26 16:13 UTC] martijn at openbsd dot org
When a read from the session backend fails it still initializes the session without data. This causes problems during either the closing of the session or the php_session_decode (depending on the serializer) with writing an empty session or destroying the session data respectively.

I choose E_ERROR to be in line with s_open and s_create_id function checks, but it can easily changed into E_WARNING to be more in line with the original comment and would cause a return FALSE, because PS(session_status) is not php_session_active.

I haven't looked into other versions, but I guess this applies to other versions as well.

Test script:
Originally found with as a session backend.
The script below can be tested by setting up memcached and doing a
"add memc.sess.lock.<session_id> 0 0 1"  on a telnet session to memcached (make sure that memcached.session_locking is set, which it is by default).
The request will first hang and at the end reset the session content in memcached.

ini_set('session.save_handler', 'memcached');
ini_set('session.save_path', "");

var_dump($_SESSION, session_id());
$_SESSION["a"] = "b";


session_read_check (last revision 2016-10-26 16:13 UTC by martijn at openbsd dot org)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-19 17:20 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-03-19 17:20 UTC]
It seems to me that is fixex as of PHP 7.1.0, although in a
different way, or is there still something to improve?
 [2021-03-28 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 24 02:01:32 2024 UTC