question about note on php.net

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-11-2007
Michael Cooper
 
Posts: n/a
Default question about note on php.net

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!
Reply With Quote
  #2 (permalink)  
Old 08-11-2007
Stut
 
Posts: n/a
Default Re: [PHP] question about note on php.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!


Erm, what note where on php.net?

-Stut

--
http://stut.net/
Reply With Quote
  #3 (permalink)  
Old 08-12-2007
brian
 
Posts: n/a
Default Re: [PHP] question about note on php.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
Reply With Quote
  #4 (permalink)  
Old 08-12-2007
Stut
 
Posts: n/a
Default Re: [PHP] question about note on php.net

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/
Reply With Quote
  #5 (permalink)  
Old 08-13-2007
Lala Lajpathrai
 
Posts: n/a
Default Re: question about note on php.net

Hi

Include ob_start() function as first statement in every page. it will
maintain existing session state.

Reply With Quote
  #6 (permalink)  
Old 08-13-2007
Richard Lynch
 
Posts: n/a
Default Re: [PHP] question about note on php.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?
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:32 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0