This is a discussion on question about note on php.net within the PHP General forums, part of the PHP Programming Forums category; Hello, I have a question--is the note from equazcion here correct? It is left unchallenged on the page but ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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!
|
|
|||
|
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! Erm, what note where on php.net? -Stut -- http://stut.net/ |
|
|||
|
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. My $.02 |
|
|||
|
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/ex...session.c#1473 -- http://stut.net/ |
|
|||
|
On Sat, August 11, 2007 1:54 pm, 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! If I could remember/find the URL to login, I could delete that bogus note... It's about as wrong as it gets. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? |