Export to GitHub

simpledom - issue #4

AppendChild not works because param fails


Posted on Apr 28, 2011 by Helpful Camel

hi once more,

sometimes SimpleDOM fires a warning because appendChild expects a parameter as an object. so i added myself behind line 191 something like that:

if(!is_object($args[0]) && $name=="appendChild") { $ret=false; } else $ret = call_user_func_array(array($dom, $name), $args);

well not very pretty but prevent the warning..

Comment #1

Posted on May 26, 2011 by Swift Hippo

I don't consider this behaviour as a bug. In fact, it's intended to work this way.

SimpleDOM is meant to be little more than a medium between SimpleXML and the DOM extension. Any usage that would generate an error when DOM is used should generate the same error via SimpleDOM.

In your case, you should check whether the argument is a node before you try to append it.

Status: New

Labels:
Type-Defect Priority-Medium