Error with DOMDocument->saveXML()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok how I have things set up is I have a Document Object which when 
instantiated creates a root element and adds it to the DOM object.
After that all population of this node is done on the requested page.

When I'm done populating I output my header()'s and then echo my Document 
Object. I've overridden the __toString() method.
Once here it does 1 of 2 things.
Transform via XSL or just dump the XML via saveXML()
to do this either I do a:
$this->outXML = isset($_GET['xml']);
This makes it so on any page I can add a ?xml and get the raw untransformed 
XML.

So first I don't have that switch on and I get my fully populated website 
nicely done up by XSL.
Then I throw that switch on and I get:
<br />
<b>Fatal error</b>:  Method Document::__toString() must return a string value 
in <b>/srv/www/localhost/htdocs/db/index.php</b> on line <b>140</b><br />

which is very interesting because as I just said the transform via XSL was 
done just fine which proves that I do in fact have a fully populated node.
So thinking I might have made an error with that ?xml switch I check my code 
over.. everything is in order but for the sake of testing I commented out the 
transformXML line and paste my return saveXML line refresh... same error.
So now we know that there is nothing wrong my ?xml switch.

So now it could still be the method saveXML(). I've not tested this 
functionality of my site in a while I did recently upgrade to 5.0.5 I'm not 
positive but I'm pretty sure it's worked since then tho. But anyway to test 
the method I did a:
$this->Dom = DOMDocument::loadXML("<a>asdf</a>");
echo $this->Dom->saveXML();  // Same line that's always been there.

and it works. So the function does work... Now what?
Is there anything else I can try? could this be a PHP bug? I am completely 
confused on what is going on...
I've not checked my E_NOTICE's yet.. actually not quite sure how to turn these 
on, on a per site basis (if that's even possible.) I'll take even a server 
wide solution if it means getting more on how to fix this. I'd figure this 
part out myself but I'm due to get off to work in... -4 mins (or 4 mins 
ago :)).

Thanks,
Stephen Leaf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux