From d699569f5ad8bb56f31a36e2c65bf1577cf9e153 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Sat, 29 Nov 2003 13:07:20 +0000 Subject: [PATCH] it's now possible to return a DomNode from userland functions back to the xsl-processor --- ext/xsl/php_xsl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c index 1661a5930f..49af31417d 100644 --- a/ext/xsl/php_xsl.c +++ b/ext/xsl/php_xsl.c @@ -256,7 +256,14 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(&handler)); } } else { - if (retval->type == IS_BOOL) { + if (retval->type == IS_OBJECT && instanceof_function( Z_OBJCE_P(retval), dom_node_class_entry)) { + xmlNode *nodep; + dom_object *obj; + obj = (dom_object *)zend_object_store_get_object(retval TSRMLS_CC); + nodep = dom_object_get_node(obj); + valuePush(ctxt, xmlXPathNewNodeSet(nodep)); + } + else if (retval->type == IS_BOOL) { valuePush(ctxt, xmlXPathNewBoolean(retval->value.lval)); } else { convert_to_string_ex(&retval); @@ -362,6 +369,7 @@ PHP_MSHUTDOWN_FUNCTION(xsl) UNREGISTER_INI_ENTRIES(); */ xsltCleanupGlobals(); + //xmlMemoryDump(); return SUCCESS; } -- 2.50.1