FAQ
rrichards Fri Apr 8 11:59:38 2005 EDT

Added files: (Branch: PHP_5_0)
/php-src/ext/dom/tests bug32615.phpt

Modified files:
/php-src/ext/dom node.c
Log:
- MFH Fixed bug #32615 (Segfault in replaceChild() using fragment when
previousSibling is NULL)
- add test

Search Discussions

  • Rob Richards at Apr 18, 2005 at 11:08 pm
    rrichards Mon Apr 18 19:08:41 2005 EDT

    Modified files: (Branch: PHP_5_0)
    /php-src/ext/dom node.c
    /php-src/ext/dom/tests bug32615.phpt
    Log:
    MFH: Fix bug #32755 Segfault in replaceChild() when DocumentFragment has no children
    update test

    http://cvs.php.net/diff.php/php-src/ext/dom/node.c?r1=1.29.2.4&r2=1.29.2.5&ty=u
    Index: php-src/ext/dom/node.c
    diff -u php-src/ext/dom/node.c:1.29.2.4 php-src/ext/dom/node.c:1.29.2.5
    --- php-src/ext/dom/node.c:1.29.2.4 Fri Apr 8 11:59:38 2005
    +++ php-src/ext/dom/node.c Mon Apr 18 19:08:41 2005
    @@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
    */

    -/* $Id: node.c,v 1.29.2.4 2005/04/08 15:59:38 rrichards Exp $ */
    +/* $Id: node.c,v 1.29.2.5 2005/04/18 23:08:41 rrichards Exp $ */

    #ifdef HAVE_CONFIG_H
    #include "config.h"
    @@ -1134,7 +1134,9 @@
    xmlUnlinkNode(oldchild);

    newchild = _php_dom_insert_fragment(nodep, prevsib, nextsib, newchild, intern, newchildobj TSRMLS_CC);
    - dom_reconcile_ns(nodep->doc, newchild);
    + if (newchild) {
    + dom_reconcile_ns(nodep->doc, newchild);
    + }
    } else if (oldchild != newchild) {
    if (newchild->doc == NULL && nodep->doc != NULL) {
    xmlSetTreeDoc(newchild, nodep->doc);
    http://cvs.php.net/diff.php/php-src/ext/dom/tests/bug32615.phpt?r1=1.1.2.2&r2=1.1.2.3&ty=u
    Index: php-src/ext/dom/tests/bug32615.phpt
    diff -u php-src/ext/dom/tests/bug32615.phpt:1.1.2.2 php-src/ext/dom/tests/bug32615.phpt:1.1.2.3
    --- php-src/ext/dom/tests/bug32615.phpt:1.1.2.2 Fri Apr 8 11:59:38 2005
    +++ php-src/ext/dom/tests/bug32615.phpt Mon Apr 18 19:08:41 2005
    @@ -62,6 +62,12 @@
    $frag->appendChild(new DOMElement('third'));
    $root->insertBefore($frag, $node);

    +echo $dom->saveXML()."\n";
    +
    +$frag = $dom->createDocumentFragment();
    +$root = $dom->documentElement;
    +$root->replaceChild($frag, $root->firstChild);
    +
    echo $dom->saveXML();

    ?>
    @@ -73,3 +79,6 @@
    <?xml version="1.0"?>
    <root><first/><second/><third/><fourth/></root>

    +<?xml version="1.0"?>
    +<root><second/><third/><fourth/></root>
    +

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-cvs @
categoriesphp
postedApr 8, '05 at 3:59p
activeApr 18, '05 at 11:08p
posts2
users1
websitephp.net

1 user in discussion

Rob Richards: 2 posts

People

Translate

site design / logo © 2019 Grokbase