note 83309 added to ref.simplexml
| From: | pc_storm at abv dot bg | Date: | Tue, 20 May 2008 12:16:27 +0000 |
| Subject: | note 83309 added to ref.simplexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139553@lists.php.net to get a copy of this message | ||
You can avoid easily, the unpredictable destruction of $_SESSION when loading a simple_xml object
(which occurs under _some_ PHP versions) by serializing and unserializing it:
<?php
$oldsession=serialize($_SESSION);
$myxml=@simplexml_load_file('my.xml');
$_SESSION=unserialize($oldsession);
unset ($oldsession);
?>
This worked for me under PHP 5.2.5 while on 5.1.6 there was no need for such workaround at all.
Same workaround should help if there are other superglobals affected by this bug...
----
Server IP: 217.75.128.29
Probable Submitter: 87.126.31.26
----
Manual Page -- http://www.php.net/manual/en/ref.simplexml.php
Edit -- https://master.php.net/note/edit/83309
Del: integrated -- https://master.php.net/note/delete/83309/integrated
Del: useless -- https://master.php.net/note/delete/83309/useless
Del: bad code -- https://master.php.net/note/delete/83309/bad+code
Del: spam -- https://master.php.net/note/delete/83309/spam
Del: non-english -- https://master.php.net/note/delete/83309/non-english
Del: in docs -- https://master.php.net/note/delete/83309/in+docs
Del: other reasons-- https://master.php.net/note/delete/83309
Reject -- https://master.php.net/note/reject/83309
Search -- https://master.php.net/manage/user-notes.php