|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-10-25 02:10 UTC] maratd at gmail dot com
Description: ------------ SimpleXML objects can't be stored in sessions and in turn, objects which contain SimpleXML objects also can't be stored. Reproduce code: --------------- <?php session_start(); $_SESSION['xml'] = simplexml_load_file(YOUR_XML_FILE); ?> Expected result: ---------------- I expect the simplexml object to be loaded as a session variable, to work, and to persist while the session is active. Actual result: -------------- If you first run the code above in a browser on a valid xml file, nothing happens and it looks like it works ... but if you hit refresh or go to a page which re-starts the session, you will see this: Warning: session_start() [function.session-start]: Node no longer exists in index.php on line 3 The above warning line will repeat over and over for a while ... your simplexml object also won't work. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 04:00:01 2025 UTC |
I have checked the manual many times in the past and have done so again. Nowhere does it mention that SimpleXML objects can't be stored as a session variable. I rewrote the code so that you don't have to create an xml file. Here it is: <?php session_start(); $_SESSION['xml'] = simplexml_load_string('<test><one>two</one></test>'); ?> Please run the code provided and restart the session on another page (or hit refresh in your browser). Here is what you will see (the path will obviously be different): Warning: session_start() [function.session-start]: Node no longer exists in c:\Inetpub\wwwroot\TEMP\test1.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at c:\Inetpub\wwwroot\TEMP\test1.php:3) in c:\Inetpub\wwwroot\TEMP\test1.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\Inetpub\wwwroot\TEMP\test1.php:3) in c:\Inetpub\wwwroot\TEMP\test1.php on line 3 I appreciate any help in this manner. Thank you. - Marat