diff options
author | Rob Richards <rrichards@php.net> | 2004-03-03 20:59:02 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2004-03-03 20:59:02 +0000 |
commit | 4ce377064a804ebae5cdd85e08cb435d24320c2c (patch) | |
tree | fa6b691c39bf310e2baf9911c807a748b84dd95a /ext/dom/document.c | |
parent | 865903a2a47b47f2e59be4c62b7dc0bc159eabf1 (diff) | |
download | php-git-4ce377064a804ebae5cdd85e08cb435d24320c2c.tar.gz |
Fix bug #27467: domDocument::load() called from class method crashes
the methods can be called statically only from within classes which
are not extending DomDocument
Diffstat (limited to 'ext/dom/document.c')
-rw-r--r-- | ext/dom/document.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c index c53b7bdb3c..465725a2b3 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1484,7 +1484,10 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) { int source_len, refcount, ret; id = getThis(); - + if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) { + id = NULL; + } + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) { return; } @@ -1978,7 +1981,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) if (!newdoc) RETURN_FALSE; - if (id != NULL) { + if (id != NULL && instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) { intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); if (intern != NULL) { docp = (xmlDocPtr) dom_object_get_node(intern); |