Index: php_xsl.c =================================================================== RCS file: /repository/php-src/ext/xsl/php_xsl.c,v retrieving revision 1.32.2.6.2.2 diff -u -r1.32.2.6.2.2 php_xsl.c --- php_xsl.c 12 Jan 2007 12:17:32 -0000 1.32.2.6.2.2 +++ php_xsl.c 2 Oct 2007 07:08:45 -0000 @@ -123,6 +123,7 @@ intern->registered_phpfunctions = NULL; intern->node_list = NULL; intern->doc = NULL; + intern->profiling = NULL; zend_object_std_init(&intern->std, class_type TSRMLS_CC); zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); Index: php_xsl.h =================================================================== RCS file: /repository/php-src/ext/xsl/php_xsl.h,v retrieving revision 1.15.2.1.2.1 diff -u -r1.15.2.1.2.1 php_xsl.h --- php_xsl.h 1 Jan 2007 09:36:10 -0000 1.15.2.1.2.1 +++ php_xsl.h 2 Oct 2007 07:08:45 -0000 @@ -60,6 +60,7 @@ HashTable *registered_phpfunctions; HashTable *node_list; php_libxml_node_object *doc; + char *profiling; } xsl_object; void php_xsl_set_object(zval *wrapper, void *obj TSRMLS_DC); Index: xsl_fe.h =================================================================== RCS file: /repository/php-src/ext/xsl/xsl_fe.h,v retrieving revision 1.8.2.1.2.1 diff -u -r1.8.2.1.2.1 xsl_fe.h --- xsl_fe.h 1 Jan 2007 09:36:10 -0000 1.8.2.1.2.1 +++ xsl_fe.h 2 Oct 2007 07:08:45 -0000 @@ -33,4 +33,5 @@ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter); PHP_FUNCTION(xsl_xsltprocessor_has_exslt_support); PHP_FUNCTION(xsl_xsltprocessor_register_php_functions); +PHP_FUNCTION(xsl_xsltprocessor_set_profiling); #endif Index: xsltprocessor.c =================================================================== RCS file: /repository/php-src/ext/xsl/xsltprocessor.c,v retrieving revision 1.39.2.2.2.9 diff -u -r1.39.2.2.2.9 xsltprocessor.c --- xsltprocessor.c 30 Jul 2007 16:33:22 -0000 1.39.2.2.2.9 +++ xsltprocessor.c 2 Oct 2007 07:08:45 -0000 @@ -44,6 +44,7 @@ PHP_FALIAS(removeParameter, xsl_xsltprocessor_remove_parameter, NULL) PHP_FALIAS(hasExsltSupport, xsl_xsltprocessor_has_exslt_support, NULL) PHP_FALIAS(registerPHPFunctions, xsl_xsltprocessor_register_php_functions, NULL) + PHP_FALIAS(setProfiling, xsl_xsltprocessor_set_profiling, NULL) {NULL, NULL, NULL} }; @@ -343,9 +344,7 @@ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oo", &id, xsl_xsltprocessor_class_entry, &docp) == FAILURE) { RETURN_FALSE; } - nodep = php_libxml_import_node(docp TSRMLS_CC); - if (nodep) { doc = nodep->doc; } @@ -424,7 +423,8 @@ int clone; zval *doXInclude, *member; zend_object_handlers *std_hnd; - + FILE *f; + node = php_libxml_import_node(docp TSRMLS_CC); if (node) { @@ -439,6 +439,17 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stylesheet associated to this object"); return NULL; } + + if (intern->profiling) { + if (php_check_open_basedir(intern->profiling TSRMLS_CC)) { + f = NULL; + } else { + f = VCWD_FOPEN(intern->profiling, "w"); + } + } else { + f = NULL; + } + if (intern->parameter) { params = php_xsl_xslt_make_params(intern->parameter, 0 TSRMLS_CC); } @@ -468,9 +479,11 @@ ctxt->xinclude = Z_LVAL_P(doXInclude); } efree(member); - - newdocp = xsltApplyStylesheetUser(style, doc, (const char**) params, NULL, NULL, ctxt); - + + newdocp = xsltApplyStylesheetUser(style, doc, (const char**) params, NULL, f, ctxt); + if (f) { + fclose(f); + } xsltFreeTransformContext(ctxt); if (intern->node_list != NULL) { @@ -483,6 +496,9 @@ efree(intern->doc); intern->doc = NULL; + if (intern->profiling) { + efree(intern->profiling); + } if (params) { clone = 0; @@ -772,6 +788,31 @@ } /* }}} end xsl_xsltprocessor_register_php_functions(); */ +/* {{{ proto bool xsl_xsltprocessor_set_profiling(string filename) */ +PHP_FUNCTION(xsl_xsltprocessor_set_profiling) +{ + + zval *id; + zval *array_value, **entry, *new_string; + xsl_object *intern; + char *filename; + int filename_len; + DOM_GET_THIS(id); + + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == SUCCESS) { + intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); + + intern->profiling = estrndup(filename,filename_len); + + RETURN_TRUE; + + } else { + WRONG_PARAM_COUNT; + } + +} +/* }}} end xsl_xsltprocessor_set_profiling */ + /* {{{ proto bool xsl_xsltprocessor_has_exslt_support(); */ PHP_FUNCTION(xsl_xsltprocessor_has_exslt_support)