diff options
author | Rob Richards <rrichards@php.net> | 2004-03-01 12:09:24 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2004-03-01 12:09:24 +0000 |
commit | 76ee5707f76aeaefbe128b1cd0ea1d5521c860c7 (patch) | |
tree | 1506c10ed79407170b7b6ac039162dc65dc5a2bd /ext/xsl | |
parent | 9f9151473c5a14c45faf4e2f804097ec83c9b00d (diff) | |
download | php-git-76ee5707f76aeaefbe128b1cd0ea1d5521c860c7.tar.gz |
Fix bug #27436 dom_import_simplexml innaccurate
extensions register callbacks to export nodes
prevents segfault passing invalid objects to import functions
Diffstat (limited to 'ext/xsl')
-rw-r--r-- | ext/xsl/xsltprocessor.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index 37358d01be..4187b6760c 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -296,19 +296,24 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) xmlDoc *doc = NULL, *newdoc = NULL; xsltStylesheetPtr sheetp, oldsheetp; xsl_object *intern; - php_libxml_node_object *docobj; int prevSubstValue, prevExtDtdValue, clone_docu = 0; - xmlNode *nodep; + xmlNode *nodep = NULL; zend_object_handlers *std_hnd; zval *cloneDocu, *member; - - DOM_GET_THIS(id); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &docp) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oo", &id, xsl_xsltprocessor_class_entry, &docp) == FAILURE) { RETURN_FALSE; } - DOC_GET_OBJ(doc, docp, xmlDocPtr, docobj); + nodep = php_libxml_import_node(docp TSRMLS_CC); + + if (nodep) { + doc = nodep->doc; + } + if (doc == NULL) { + php_error(E_WARNING, "Invalid Document"); + RETURN_NULL(); + } /* libxslt uses _private, so we must copy the imported stylesheet document otherwise the node proxies will be a mess */ |