diff options
| author | Rob Richards <rrichards@php.net> | 2005-10-27 23:51:22 +0000 |
|---|---|---|
| committer | Rob Richards <rrichards@php.net> | 2005-10-27 23:51:22 +0000 |
| commit | 2e8f773eee184bb31c07144b24dfa1c6c625fec4 (patch) | |
| tree | 43dace14f9b2bd98669e57c776992865213d9333 /ext/dom/element.c | |
| parent | a9cac89541297bd15af2ce6b0ae9e92b37e3e49b (diff) | |
| download | php-git-2e8f773eee184bb31c07144b24dfa1c6c625fec4.tar.gz | |
MFH: fix crash setting attr from foreign doc (throws exception)
add test
Diffstat (limited to 'ext/dom/element.c')
| -rw-r--r-- | ext/dom/element.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/dom/element.c b/ext/dom/element.c index 3aa82fa6ae..6017707613 100644 --- a/ext/dom/element.c +++ b/ext/dom/element.c @@ -368,6 +368,11 @@ PHP_FUNCTION(dom_element_set_attribute_node) RETURN_FALSE; } + if (!(attrp->doc == NULL || attrp->doc == nodep->doc)) { + php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + RETURN_FALSE; + } + existattrp = xmlHasProp(nodep, attrp->name); if (existattrp != NULL && existattrp->type != XML_ATTRIBUTE_DECL) { if ((oldobj = php_dom_object_get_data((xmlNodePtr) existattrp)) != NULL && @@ -769,6 +774,11 @@ PHP_FUNCTION(dom_element_set_attribute_node_ns) RETURN_FALSE; } + if (!(attrp->doc == NULL || attrp->doc == nodep->doc)) { + php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + RETURN_FALSE; + } + nsp = attrp->ns; if (nsp != NULL) { existattrp = xmlHasNsProp(nodep, nsp->href, attrp->name); |
