|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-09-06 10:43 UTC] jani@php.net
[2007-09-14 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 16:00:01 2025 UTC |
Description: ------------ The following session is stored in my temp directory: old_var2|s:4:"foo2"; I try to iterate over the $_SESSION var (using foreach) to unset some session keys, in particular those who start with "old_" (see the attached code). But I can't. Besides, if after this iteration I try to modify the $_SESSION var nothing happens. I'm using IIS 5.1 (blame my boss). Reproduce code: --------------- session_start(); $prefix = 'old_'; foreach ($_SESSION as $key => $value) { if (substr($key, 0, 4) == $prefix) { unset($_SESSION[$key]); } } $_SESSION['var1'] = 'foo'; Expected result: ---------------- This change in the session file: var1|s:3:"foo"; Actual result: -------------- old_var2|s:4:"foo2";