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:

This test case I posted is with register_global turned off.  Well, the
documentation should stated that the number can not be used as the
first character.  I wonder how can anyone tell the difference on
$_SESSION from an array?  It look a lot like an array in some way.


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

[2002-07-05 15:50:47] [EMAIL PROTECTED]

As session variables are subject to be registered as global variables
(if register_globals is on), and identifier names (including variable
names) cannot begin with a numeric character, it's not too hard to see
that session variables should not begin with a number. Basically
session variables
should follow naming ruiles for identifiers IMHO.

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

[2002-07-05 15:46:23] [EMAIL PROTECTED]

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

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

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

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

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