ID:               17122
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Verified
 Bug Type:         Documentation problem
 Operating System: Linux RH 7.2
 PHP Version:      4.2.0


Previous Comments:
------------------------------------------------------------------------

[2002-06-28 09:11:18] [EMAIL PROTECTED]

You're not supposed to do that. But it should indeed be documented.


------------------------------------------------------------------------

[2002-06-28 06:15:31] [EMAIL PROTECTED]

Ok, that seems reasonable. (Even though I cannot find anything in the
manual that explicitly states that numerical indexes are unsupported)
However, the setting of a numerical index seems to silently break
something, since the other values in the example are affected as well.
Is this really the intended behavior?

------------------------------------------------------------------------

[2002-06-27 23:07:05] [EMAIL PROTECTED]

Numerical indexes in $_SESSION are NOT supported.
(and never will be) 

User error -> bogus.



------------------------------------------------------------------------

[2002-05-15 08:03:25] [EMAIL PROTECTED]

what if you try :

<?
session_start();
session_register("foo");
session_register(4);
session_register("a");
session_register("counter");

print "<PRE>";
print "Current values:\n";
print '"foo"=' . $_SESSION["foo"] . "\n";
print '4=' . $_SESSION[4]."\n";
print '"a"=' . $_SESSION["a"]."\n";

$_SESSION["foo"] = "bar";
$_SESSION[4] = "four";
$_SESSION["a"] = "b";

if(!isset($_SESSION["counter"]))
     $_SESSION["counter"] = 1;
else
     $_SESSION["counter"]++;
print "Count = ".$_SESSION["counter"]."\n";
print "</PRE>";
?>


$_SESSION["foo"] and $_SESSION["counter"] should be working

$_SESSION[4] doesn't (I guess its because of the numerical key) and
$_SESSION["a"] neither (but works if "a" is changed to "ab").

/Leblanc

------------------------------------------------------------------------

[2002-05-09 11:34:40] [EMAIL PROTECTED]

I'm having problems using $_SESSION, it throws away some of my values
between page loads. The following code triggers the problem.

<?
session_start();
print "<PRE>";
print "Current values:\n";
print '"foo"=' . $_SESSION["foo"] . "\n";
print '4=' . $_SESSION[4]."\n";
print '"a"=' . $_SESSION["a"]."\n";

$_SESSION["foo"] = "bar";
$_SESSION[4] = "four";
$_SESSION["a"] = "b";

if(!isset($_SESSION["counter"]))
     $_SESSION["counter"] = 1;
else
     $_SESSION["counter"]++;
print "Count = ".$_SESSION["counter"]."\n";
print "</PRE>";
?>

The first run, it prints this:

  Current values:
  "foo"=
  4=
  "a"=
  Count = 1

Which is what is expected, since the values haven't been set yet,
except for the counter. 

Now the second run, this is where the problem show up:

  Current values:
  "foo"=bar
  4=
  "a"=
  Count = 1

This seems to be wrong! The first value has been set, but none of the
others. The counter should have been incremented also. The expected
result of the second run would be

  Current values:
  "foo"=bar
  4=four
  "a"=b
  Count = 2


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17122&edit=1


-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to