Re: question about note on php.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



brian wrote:
Michael Cooper wrote:
Hello, I have a question--is the note from equazcion here correct? It
is left unchallenged on the page but I can't see how it is correct since I am under the impression that the environment is refreshed each page load and the function or method definitions (including those for session_set_save_handler) would need to be re-established each page, not each session. I am having tremendous difficulty debugging some code I wrote and eliminating my uncertainty regarding this point would be greatly helpful. Any advice would be appreciated. Thanks!

Because i'm already procrastinating ...

google "site:php.net equazcion"

http://www.php.net/session_set_save_handler

wherein:

equazcion
10-Mar-2007 02:44
I know this might be obvious, but session_set_save_handler() should
only be called once per session, or else your saved data will keep
getting reset.

If your script doesn't have a predictable start page that will only
be called only once per session, place the session_set_save_handler
statement in an include file, and call it via require_once().

I doubt that this is correct. The save handler that is being set is not, in itself, a part of the session, but a function that is to be used to act upon the session. That is, there isn't anything inherent to the session in the function. Thus, it wouldn't be saved as *a part of* the session. It's just a handler. It's not as if the function, itself, were a container for the session vars.

Looking at the source in head for that function[1] it would appear to fail if a session has already been started, in which case equizcion's comment would be wrong.

If the OP is concerned about it I suggest they try it and see what happens.

-Stut

[1] http://lxr.php.net/source/php-src/ext/session/session.c#1473

--
http://stut.net/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux