Re: Problems reading a DOMDocument out of a session

From: Date: Mon, 25 Apr 2005 18:24:33 +0000
Subject: Re: Problems reading a DOMDocument out of a session
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-213821@lists.php.net to get a copy of this message
Cas wrote:
Hi, I'm trying to read a (XML object) DOMDocument from an session but when I try to do this from another page then where it's declared, it can't be read it. I _can_ read the DOMDocument on the same page out of the session. and also print_r(_SESSION); shows it still is a DOMDocument on all pages. The attached file shows the problem. I get different results running the script on PHP 5.0.3 and 5.0.4 servers (all linux). My expected result is that the DOMDocument is printed out when submit is hit, but instead it gives different results: Fatal error: Call to a member function saveXML() on a non-object in /var/www/localhost/htdocs/dom_session.php on line 21 and Warning: Couldn't fetch DOMDocument in /var/www/localhost/htdocs/dom_session.php on line 21
I had a look at you problem... and I found it impossible to reproduce the errors or warnings - this leads me to believe that something on your system(s) is ****ed, libxml2 would a good place to start looking.... BUT, even though I managed to retrieve the DomDocument object from the session on the second/subsequent requests the object stored in the session did not contain the XML string that was originally loaded.... so that $_SESSION['dom']->saveXML() return NULL. which is not what I would expect but maybe its correct behaviour. anyway if you get so far as to see the same behaviour as I do you may have something solid to report as a bug (or at least post a question here, or possibly on internals) otherwise you're looking at refactoring you code to work around the problem
I thought it was a bug in PHP and opened a bug report allready but it's closed. http://bugs.php.net/?id=32825 Does anyone has an idea what could be wrong with it? Thanks in advance, Caspar Adriani


« previous php.general (#213821) next »