From: Rob Richards Date: Wed, 3 Mar 2004 20:59:02 +0000 (+0000) Subject: Fix bug #27467: domDocument::load() called from class method crashes X-Git-Tag: RELEASE_0_2_0~64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ce377064a804ebae5cdd85e08cb435d24320c2c;p=php 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 --- 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);