PHP runkit and DOM insertAfter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael J Martin

    PHP runkit and DOM insertAfter

    Any idea why PHP runkit does not allow you to extend a non-user-defined
    class?

    In PHP runkit_methods. c it seems to do a check and calls
    php_error_docre f with E_WARNING ("class %s is not a user-defined
    class") and returns FAILURE for the runkit function.

    I'm trying to extend DOMNode/DOMElement and I cant just extend them
    normally because DOMDocument wont return this new extended class in its
    various functions and that's going to be a pain to deal with. Actually
    thats another point - this is probably a DOM standard issue but why is
    there no DOMNode::insert After() method?

    Also how come DOMNode::insert Before() needs a refnode instead of just
    inserting before itself - that would seem insanely more logical to me
    but then I am not the W3C and I don't have their infinite, dare I say
    prophetic wisdom. If I have shown my ignorance to the DOM standard
    please have mercy on me for I am nothing more than a minion and so
    short-sighted that I am sure to miss their reasoning for making us jump
    through hoops with $node->parentNode->insertBefore($ new, $node); rather
    than $node->insertBefore($ new);

Working...