$dom->getElementsByTagName($key)->item(0)->nodeValue = (string) $value;
I have this line which throws this error. I am working with DOMDocument for years and never experienced this before. Actually I am testing the $dom before just to make sure it's all good like this:
if (gettype($dom) === "object") {
if ($dom instanceof DOMDocument) {
$dom->getElementsByTagName($key)->length>0
? – Passerby Feb 27 '13 at 3:39