]> granicus.if.org Git - php/commitdiff
it's now possible to return a DomNode from userland functions back to the xsl-processor
authorChristian Stocker <chregu@php.net>
Sat, 29 Nov 2003 13:07:20 +0000 (13:07 +0000)
committerChristian Stocker <chregu@php.net>
Sat, 29 Nov 2003 13:07:20 +0000 (13:07 +0000)
ext/xsl/php_xsl.c

index 1661a5930f1b3dba568b8f33cf2169ba2b4e87ea..49af31417d2ca974afa319993768e6a866063355 100644 (file)
@@ -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;
 }