note 83309 deleted from function.simplexml-load-file by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 11:00:16 +0000 |
| Subject: | note 83309 deleted from function.simplexml-load-file by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197002@lists.php.net to get a copy of this message | ||
Note Submitter: pc_storm at abv dot bg
----
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...