|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-03-25 16:28 UTC] cmb@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: cmb
[2021-03-25 16:28 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 04:00:01 2025 UTC |
Description: ------------ Found this behavior on a productive System: User calls URI with empty SID parameter like this: test.php?mySID= php / memcache spits out warnings and session functionality is not available on this page (write doesn't work). Standard PHP files session handler handles this error by generating a new id and uses the new one to write session data and sends a cookie with the new id. memcache session handler used to throw a ugly warning. Since 3.0.4 it just ignores the problem. Leaves developers alone with probably messed up pages. Instead of ignoring the issue memcache should generate a new id and use it just like the standard files handler would do. Versions: PHP: from 5.2.6 to 5.3.1 stable memcache: all from 2.2.5 to 3.0.4 tested on lighttpd with php-cgi php.ini changes: session.save_handler = memcache session.save_path = "tcp://localhost:11211" session.use_only_cookies = 0 Reproduce code: --------------- <? session_name('mySID'); session_start(); echo session_name()."=".session_id()."<br>\n"; $_SESSION['count']++; var_dump($_SESSION); workaround: <? session_name('mySID'); if ($_GET[session_name()] == "") unset($_GET[session_name()]); session_start(); echo session_name()."=".session_id()."<br>\n"; $_SESSION['count']++; var_dump($_SESSION); Expected result: ---------------- A new generated Session_id on every reguest for 'test.php?mySID=' if client disabled cookies. Actual result: -------------- Empty Session_id and no write of session data. On older memcache versions (<3.0.3) PHP Warnings and Errors like: Warning: Unknown: Failed to write session data (memcache). Please verify that the current setting of session.save_path is correct (tcp://localhost:11211) in Unknown on line 0 Warning: session_start() [function.session-start]: Key cannot be empty in /var/www/index.php on line 4