par
rami » 17 déc. 2005, 23:31
J'avance dans la recherche du problème. Il semble que cela vienne de l'objet simpleXml. Par exemple:
test.class.php
<?php
class Test
{
public $foo = null;
public function __construct()
{
$this->foo = simplexml_load_string('<root><valeur name="machin"/></root>');
}
public function __sleep()
{
$this->foo = $this->foo->asXML();
}
public function __wakeup()
{
$this->foo = simplexml_load_string($this->foo);
}
}
?>
test.php
<?php
include 'test.class.php';
session_start();
if(isset($_GET["off"]))
session_destroy();
$t = new Test();
if(!isset($_SESSION['foo']))
{
$_SESSION['foo'] = $t;
echo 'on définit la session<br>';
}
echo '<pre>';
print(htmlentities($_SESSION['foo']->foo->asXML()));
echo 'Classe: '.get_class($_SESSION['foo']->foo);
?>
<a href="test.php5">Test</a><br>
<a href="test.php5?off=1"> Détruire la session</a>
Au deuxième affichage de la page apparaissent les messages d'erreur suivants:
Warning: session_start() [function.session-start]: Node no longer exists in d:\mes documents\mes sites\Site Ecv\test.php5 on line 3
Warning: session_start() [function.session-start]: Node no longer exists in d:\mes documents\mes sites\Site Ecv\test.php5 on line 3
Quelqu'un a-t-il dèjà été confronté à ce problème, car là je sèche...
edit: Il semble qu'il y ait des problèmes pour sérialiser des objets SimpleXML. Résolu en utilisant les méthodes __sleep et __wakeup.
J'avance dans la recherche du problème. Il semble que cela vienne de l'objet simpleXml. Par exemple:
test.class.php
[php]
<?php
class Test
{
public $foo = null;
public function __construct()
{
$this->foo = simplexml_load_string('<root><valeur name="machin"/></root>');
}
public function __sleep()
{
$this->foo = $this->foo->asXML();
}
public function __wakeup()
{
$this->foo = simplexml_load_string($this->foo);
}
}
?>
[/php]
test.php
[php]
<?php
include 'test.class.php';
session_start();
if(isset($_GET["off"]))
session_destroy();
$t = new Test();
if(!isset($_SESSION['foo']))
{
$_SESSION['foo'] = $t;
echo 'on définit la session<br>';
}
echo '<pre>';
print(htmlentities($_SESSION['foo']->foo->asXML()));
echo 'Classe: '.get_class($_SESSION['foo']->foo);
?>
<a href="test.php5">Test</a><br>
<a href="test.php5?off=1"> Détruire la session</a>[/php]
Au deuxième affichage de la page apparaissent les messages d'erreur suivants:
[b]Warning[/b]: session_start() [function.session-start]: Node no longer exists in d:\mes documents\mes sites\Site Ecv\test.php5 on line 3
[b]Warning[/b]: session_start() [function.session-start]: Node no longer exists in d:\mes documents\mes sites\Site Ecv\test.php5 on line 3
Quelqu'un a-t-il dèjà été confronté à ce problème, car là je sèche... #-o
edit: Il semble qu'il y ait des problèmes pour sérialiser des objets SimpleXML. Résolu en utilisant les méthodes __sleep et __wakeup.