You are here: Re: stange behavior of $_SESSION « PHP Language « IT news, forums, messages
Re: stange behavior of $_SESSION

Posted by Michael Fesser on 01/07/08 11:25

..oO(Peter Pei)

>The fact is that $_SESSION[] = "a"; $_SESSION[]="b"; works - works on the
>initial page when it is set up.

It doesn't work. Configure your error_reporting directive how it should
be to E_ALL|E_STRICT and you'll get some notices:

Notice: Unknown: Skipping numeric key 0. in ...
Notice: Unknown: Skipping numeric key 1. in ...

>The problem is that the values are not retained on the next page. There is
>some other reasons behind, not what you have said.

Numeric keys are not allowed in the $_SESSION array. There's also a bug
report regarding this issue, even if it doesn't really clear things up.

http://bugs.php.net/bug.php?id=42472

So for an exact reason you would have to ask the PHP dev team. One
possible reason I could imagine comes from the old register_globals
days. With this directive enabled session variables were also
automatically populated as variables in the global namespace, but
variable names starting with a digit are not allowed.

Micha

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация