Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #8805
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.mixmin.net!news.unit0.net!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail |
|---|---|
| Content-Type | text/plain; charset="ISO-8859-1" |
| Message-ID | <4471622.NFrgxJaCyt@PointedEars.de> (permalink) |
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Reply-To | Thomas 'PointedEars' Lahn <php@PointedEars.de> |
| Organization | PointedEars Software (PES) |
| Date | Fri, 22 Mar 2013 17:34:36 +0100 |
| User-Agent | KNode/4.8.5 |
| Content-Transfer-Encoding | 7Bit |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| Face | iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== |
| Subject | Re: Will this set or get a SESSION variable? |
| Newsgroups | comp.lang.php |
| References | <8dd22b72-62c3-4b3c-b3ec-10ff4d682614@e16g2000yqj.googlegroups.com> <kidekm$eiu$1@speranza.aioe.org> <876cb42b-6731-44db-a25b-9ce81b49d071@y4g2000yqa.googlegroups.com> <50526567.RGmRr8SH6j@PointedEars.de> |
| MIME-Version | 1.0 |
| Lines | 68 |
| NNTP-Posting-Date | 22 Mar 2013 17:34:37 CET |
| NNTP-Posting-Host | 3827189e.newsspool3.arcor-online.net |
| X-Trace | DXC=7JRSIjhm5kC02Sh8E_NfIAMcF=Q^Z^V3H4Fo<]lROoRA8kF<OcfhCOKlR2`G9JAm;@DZm8W4\YJNLb@mF9jNikdE7a5\<`>]gfNJoP4OZM0JEF |
| X-Complaints-To | usenet-abuse@arcor.de |
| Xref | csiph.com comp.lang.php:8805 |
Show key headers only | View raw
Thomas 'PointedEars' Lahn wrote:
> David Heller wrote:
>>> > It appears to me that $_SESSION[$name] = " " or
>>> > possibly something else.
>>>
>>> You may check it out for yourself:
>>>
>>> if(in_array($name, $this->m_names))
>>> {
>>> $this->m_rules[$name][] = $rule;
>>> var_dump($_SESSION[$name]);
>>> return $_SESSION[$name];
>>>
>>> }
>>>
>>> If the session is not initialized or the session variable has not been
>>> set before, it will print NULL.
>
> As with any other PHP array when you use a non-existing key. There is
> nothing special about $_SESSION here, other than it could have been
> initialized, and the key-value pair could have been added, from session
> data set previously, elsewhere.
Another difference is that apparently the $_SESSION superglobal is *created*
by session_start():
$ php -r 'var_dump($_SESSION["foo"]);'
PHP Notice: Undefined variable: _SESSION in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
NULL
$ php -r 'session_start(); var_dump($_SESSION["foo"]);'
PHP Notice: Undefined index: foo in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
NULL
$ php -r 'var_dump($a["foo"]);'
PHP Notice: Undefined variable: a in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
NULL
$ php -r '$a = array(); var_dump($a["foo"]);'
PHP Notice: Undefined index: foo in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
NULL
$ php -r '$a = array("foo" => "bar"); var_dump($a["foo"]);'
string(3) "bar"
$ php -v
PHP 5.3.3-7+squeeze15 with Suhosin-Patch (cli) (built: Mar 4 2013 14:05:25)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with XCache v1.3.0, Copyright (c) 2005-2009, by mOo
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Will this set or get a SESSION variable? David Heller <daveh@allheller.net> - 2013-03-20 15:09 -0700
Re: Will this set or get a SESSION variable? Christoph Becker <cmbecker69@gmx.de> - 2013-03-20 23:53 +0100
Re: Will this set or get a SESSION variable? David Heller <daveh@allheller.net> - 2013-03-20 17:14 -0700
Re: Will this set or get a SESSION variable? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-22 15:41 +0100
Re: Will this set or get a SESSION variable? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-22 17:34 +0100
Re: Will this set or get a SESSION variable? Robert Heller <heller@deepsoft.com> - 2013-03-20 18:39 -0500
Re: Will this set or get a SESSION variable? Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-20 23:35 -0400
Re: Will this set or get a SESSION variable? Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-20 23:32 -0400
csiph-web