|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-10-27 09:08 UTC] dino2150 at poczta dot fm
[2012-10-27 09:45 UTC] dino2150 at poczta dot fm
[2012-10-27 09:45 UTC] dino2150 at poczta dot fm
-Status: Open
+Status: Closed
[2012-10-27 15:51 UTC] rasmus@php.net
-Status: Closed
+Status: Not a bug
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 03:00:01 2025 UTC |
Description: ------------ What I'm actually trying to do is to create pointer to session. Ok. Piece of cake. STEP:1 ---------------- session_start(); $a = &$_SESSION; $a[5] = 555; -> RUN THE SCRIPT NOW; back to edit: session_start(); $a = &$_SESSION; $a[5] = 555; print_r($_SESSION); this echoes correctly ;) STEP:2 ----------------- Let's try to zero-memory session data. session_start(); $a = &$_SESSION; $_SESSION=NULL; $a[5] = 55; $_SESSION['abc']=555; print_r($_SESSION); At this point $_SESSION contains two elements. No wonder, right? Yea..right... Now back to edit: session_start(); print_r($_SESSION); At this point session contains only ONE element? WTF happend to the $_SESSION[5]=55; it was there before... My first shot was to unset session data with session_unset so i repleaced SESSION=NULL with session_unset(). This gives me the same effect. I also took a chance with session_destroy ;) but then the SESSION table was empty (and that makes perfecly sense). However its hard to understand why $_SESSION table is saved partialy and not including values setted by $_SESSION reference, and WHY THIS ONLY HAPPEND WHEN I DO SOMETHING WITH THIS TABLE to erase it ;P Test script: --------------- TEST SCIRPT IS PART OF DESCRIPTION. Expected result: ---------------- All variables setted by SESSION reference after calling session_unset() are expected to stay in SESSION. So: first i make session ref: $a = &$_SESSION; then i zero-memory session by session_unset(); then i set something to session by ref. $a[5]=55; and i expected this to stay in session. Actual result: -------------- If i use session_unset() or nullarize session by $_SESSION=NULL and then set variables by session reference...The variables set by session reference are gone after script ends.