FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Open Session Variables
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Open Session Variables [message #171259 is a reply to message #171256] Wed, 29 December 2010 21:53 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On 29/12/10 21:24, Bill Braun wrote:
> On 12/29/2010 9:55 AM, Captain Paralytic wrote:
>> On Dec 29, 2:48 pm, Denis McMahon<denis.m.f.mcma...@googlemail.com>
>> wrote:
>>> On 29/12/10 13:33, Bill Braun wrote:
>>>
>>>> I am new to PHP coding. At the end of a series of scripts (the series
>>>> being a function of a number of header and include calls) is there a
>>>> way
>>>> to know what session variables are still set? I am running into an
>>>> intermittent error "Warning: session_start() [function.session-start]:
>>>> Node no longer exists in file.php on line X" and I suspect that I am
>>>> failing to destroy or unset some session variables.
>>>
>>>> I think I have the variables properly destroy()'d and/or unset() but
>>>> the
>>>> error make me suspicious I've overlooked something.
>>>
>>> try googling "php Node no longer exists"
>>>
>>> It's a good start. In fact, for any programming language these days,
>>> googling "<language> <error message text>" will usually throw up
>>> something helpful.
>>
>> I made the generous assumption that, despite being new to php coding,
>> the OP nevertheless had enough intelligence to put the error message
>> into Google and to have noted that all the popular hits stated this
>> being a problem with SimpleXML. If he did not then maybe programming
>> simply isn't for him.
>
> The PHP error can be avoided if the browser is closed then reloaded
> between running the scripts. That suggested to me, for what I know, that
> there is is something in the session might be unset or destroyed within
> the script, doing away with the need to close and reload the browser,
> and avoid the error.

This is because doing so destroys the session cookie, and hence the
session record.

> I had, as you rightly suggested, done some research before posting here.
> I knew of the SimpleXML explanation. What I had not yet learned was if
> there was some way to unset the session or destroy variables in such
> fashion that the error would not occur. Thus my desire to see a list of
> the session variables that were still set at the end of the script.

There's very little point using sessions if you destroy all the session
variables at the end of each script.

unset($_SESSION);

will do the job, if that's what you really want.

However, the real problem seems to be that you are storing raw simpleXML
objects in the $_SESSION array, when you should cast those objects to eg
string before storing them, and it would be better to fix that problem.

Or, possibly even better given that you're talking about destroying the
offending data items anyway, if you don't want to pass the offending
data items using the session mechanism, don't store them in the
$_SESSION array in the first place.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: initial value
Next Topic: php mail( )
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 15:07:38 GMT 2024

Total time taken to generate the page: 0.05851 seconds