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

Whoop!  One more thing!  $_SESSION[CUSTOMER_ID] does work on page 1
also!  Didn't include that as Example #3 on page 1.


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

[2002-07-05 15:43:30] [EMAIL PROTECTED]

I struggled with the $_SESSION problem for almost a week.  When I read
this report, that is when reality hit me.  In the comment written by
"[EMAIL PROTECTED]" saying that I'm not suppose to use the numberic value.
 I'm using PHP 4.2.1 and AIX 4.3.3.  Here's the example that work which
should not have work at all.  See the "//This one work!! (Numberic
Value)".

Why do I have to spend almost a week struggling over it?  I read many
documentation about $_SESSION vs. session_register() with the
register_global turned off, but they say nothing about the numeric
value that aren't allowed to be used?

Thanks,
 FletchSOD

--clip--
//-------Page 1---------
define(CUSTOMER_ID,0);
define(CUSTOMER_NAME,1);
define(STREET,4);
define(CITY,5);
define(STATE,6);
define(ZIP_CODE,7);

$salt = strtoupper(md5(uniqid(rand())));
session_id($salt);
session_start();

//$result is from odbc_exec
odbc_fetch_into($result,$_SESSION,1);

//Example #1
print_r($_SESSION);   //This one work!! (Numeric Value)

//Example #2
echo $_SESSION[0];  //This one work also! (Numberic Value)

header("Location: https://www.whatever.com/page2.php";);
//-------Page 2---------
session_start();

print_r($_SESSION);  //This one does not work!
--clip--

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

[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

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/17122

-- 
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