note 83309 modified in ref.simplexml by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 May 2009 01:11:26 +0000 |
| Subject: | note 83309 modified in ref.simplexml by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155491@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...
--was--
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...
http://php.net/manual/en/ref.simplexml.php