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
Switch to threaded view of this topic Create a new topic Submit Reply
Open Session Variables [message #171203] Wed, 29 December 2010 13:33 Go to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
Good Morning and Happy New Year,

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.

Thank you,

Bill B
Re: Open Session Variables [message #171206 is a reply to message #171203] Wed, 29 December 2010 14:42 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Dec 29, 1:33 pm, Bill Braun <m...@privacy.net> wrote:
> Good Morning and Happy New Year,
>
> 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)
I would not consider "header" calls to be part of a series of scripts.
> is there a way
> to know what session variables are still set?
print_r($_SESSION);

> 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.
You have of course searched Google for this error, so I assume that
your problem is not that you are using SimpleXML which is the cause
suggested by the vast majority of the hits?
Re: Open Session Variables [message #171207 is a reply to message #171203] Wed, 29 December 2010 14:48 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
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.

For example, I found:

http://www.php.net/manual/en/book.simplexml.php#87083
http://www.php.net/manual/en/function.unserialize.php#90520

Which both point to this being a SimpleXML related error message.

I'd guess at this point that your session start tries to load session
data that includes an xml object with a parent node that doesn't exist,
but that would very much be a guess.

As I know nothing of SimpleXML specifically, I'm unable to help further.

This may also help - seems to be the most informative brief description
that I've found:

< http://bytes.com/topic/php/answers/831550-session_start-node-no-longer-exis ts>

Rgds

Denis McMahon
Re: Open Session Variables [message #171208 is a reply to message #171207] Wed, 29 December 2010 14:55 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
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.
Re: Open Session Variables [message #171247 is a reply to message #171208] Wed, 29 December 2010 21:04 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
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.

That's a fair statement. It is also a fair statement that the answer to
any question posed here can be found from another source. So what's the
point of this group's existence if it is, in fact, unnecessary?
Re: Open Session Variables [message #171250 is a reply to message #171247] Wed, 29 December 2010 21:06 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Dec 29, 9:04 pm, Bill Braun <m...@privacy.net> 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.
>
> That's a fair statement. It is also a fair statement that the answer to
> any question posed here can be found from another source. So what's the
> point of this group's existence if it is, in fact, unnecessary?

No, it helps to supply the answers which cannot be found by looking at
the first 5 hits on a google search for the error message.
Re: Open Session Variables [message #171253 is a reply to message #171250] Wed, 29 December 2010 21:10 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 12/29/2010 4:06 PM, Captain Paralytic wrote:
> On Dec 29, 9:04 pm, Bill Braun<m...@privacy.net> 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.
>>
>> That's a fair statement. It is also a fair statement that the answer to
>> any question posed here can be found from another source. So what's the
>> point of this group's existence if it is, in fact, unnecessary?
>
> No, it helps to supply the answers which cannot be found by looking at
> the first 5 hits on a google search for the error message.

Reading my OP carefully, I was not asking for an explanation of the
error. I was using it as a context for my actual request, which,
paradoxically, before you lost your self control and felt the need to
bully someone, you answered.

Bill B
Re: Open Session Variables [message #171256 is a reply to message #171208] Wed, 29 December 2010 21:24 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
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.

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.

It may not, from an experienced programmers perspective, been very
logical to approach the problem from the direction I did. That is part
of learning. If you wish, I'm sure I can ask you some questions that do
not appear in the first 5 google responses, and then bully you for being
less than intelligent.

Deep breath, Captain, none of this is really all that important. Happy
New Year.

Bill B
Re: Open Session Variables [message #171258 is a reply to message #171253] Wed, 29 December 2010 21:37 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Dec 29, 9:10 pm, Bill Braun <m...@privacy.net> wrote:
> On 12/29/2010 4:06 PM, Captain Paralytic wrote:
>
>
>
>
>
>> On Dec 29, 9:04 pm, Bill Braun<m...@privacy.net>  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.
>
>>> That's a fair statement. It is also a fair statement that the answer to
>>> any question posed here can be found from another source. So what's the
>>> point of this group's existence if it is, in fact, unnecessary?
>
>> No, it helps to supply the answers which cannot be found by looking at
>> the first 5 hits on a google search for the error message.
>
> Reading my OP carefully, I was not asking for an explanation of the
> error. I was using it as a context for my actual request, which,
> paradoxically, before you lost your self control and felt the need to
> bully someone, you answered.
>
> Bill B

I don't recall doing any bullying. Indeed I defended you when someone
else suggested that you had not bothered to use google to find the
most likely cause for your problem.

Also, whilst it is true that you did not specifically ask for the
answer to the error, we all assumed that if you hadn't had the error,
you would not be looking at ways to diagnose the problem itself. Thus
we all tried to be helpful. Sorry if you didn't like that, I'll
remember next time to only answer very specific questions that you ask.
Re: Open Session Variables [message #171259 is a reply to message #171256] Wed, 29 December 2010 21:53 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
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
Re: Open Session Variables [message #171263 is a reply to message #171259] Wed, 29 December 2010 22:12 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 12/29/2010 4:53 PM, Denis McMahon wrote:
> 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

Thank you Denis. You are right, I was not actually going down the path
of destroying session variables, or even unsetting the session. I was
exploring those somewhat at the level of neophite desperation.

Can I search on "eg string" to fond more information about that.

I am using an inhereted script for making API calls to a website,
written by the people at the website. So I am clearly out of my league,
and this is the first I've heard/read there is an alternative to storing
the SimpleXML objects in a session variable.

It may be pertinent (it did not occur to me before to mention it) that a
cURL session is also involved in the script.

Many thanks.

Bill B
Re: Open Session Variables [message #171268 is a reply to message #171259] Wed, 29 December 2010 22:56 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Denis McMahon wrote:

> 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.
^^^^^^
Perhaps you meant to serialize() them instead?


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Re: Open Session Variables [message #171271 is a reply to message #171268] Wed, 29 December 2010 23:05 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Thomas 'PointedEars' Lahn wrote:

> Denis McMahon wrote:
>> 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.
> ^^^^^^
> Perhaps you meant to serialize() them instead?

Perhaps not. “PHP Fatal error: Uncaught exception 'Exception' with message
'Serialization of 'SimpleXMLElement' is not allowed' in Command line
code:1”.

But those objects have an asXML() method which returns their string
representation (typecast to string results in the empty string instead).


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Re: Open Session Variables [message #171306 is a reply to message #171247] Thu, 30 December 2010 08:44 Go to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
El 29/12/2010 22:04, Bill Braun escribió/wrote:
>> 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.
>
> That's a fair statement. It is also a fair statement that the answer to
> any question posed here can be found from another source. So what's the
> point of this group's existence if it is, in fact, unnecessary?

This group's purpose is basically to release stress by ranting users who
make PHP-related questions :)


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: initial value
Next Topic: php mail( )
Goto Forum:
  

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

Current Time: Sun Nov 10 15:55:50 GMT 2024

Total time taken to generate the page: 0.02525 seconds