PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - ext/xsl - xsltprocessor.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 329 432 76.2 %
Date: 2014-07-27 Functions: 15 16 93.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | PHP Version 5                                                        |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1997-2013 The PHP Group                                |
       6             :    +----------------------------------------------------------------------+
       7             :    | This source file is subject to version 3.01 of the PHP license,      |
       8             :    | that is bundled with this package in the file LICENSE, and is        |
       9             :    | available through the world-wide-web at the following url:           |
      10             :    | http://www.php.net/license/3_01.txt                                  |
      11             :    | If you did not receive a copy of the PHP license and are unable to   |
      12             :    | obtain it through the world-wide-web, please send a note to          |
      13             :    | license@php.net so we can mail you a copy immediately.               |
      14             :    +----------------------------------------------------------------------+
      15             :    | Authors: Christian Stocker <chregu@php.net>                          |
      16             :    |          Rob Richards <rrichards@php.net>                            |
      17             :    +----------------------------------------------------------------------+
      18             : */
      19             : 
      20             : /* $Id$ */
      21             : 
      22             : #ifdef HAVE_CONFIG_H
      23             : #include "config.h"
      24             : #endif
      25             : 
      26             : #include "php.h"
      27             : #include "php_xsl.h"
      28             : #include "ext/libxml/php_libxml.h"
      29             : 
      30             : /* {{{ arginfo */
      31             : ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_import_stylesheet, 0, 0, 1)
      32             :         ZEND_ARG_INFO(0, doc)
      33             : ZEND_END_ARG_INFO();
      34             : 
      35             : ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_transform_to_doc, 0, 0, 1)
      36             :         ZEND_ARG_INFO(0, doc)
      37             : ZEND_END_ARG_INFO();
      38             : 
      39             : ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_transform_to_uri, 0, 0, 2)
      40             :         ZEND_ARG_INFO(0, doc)
      41             :         ZEND_ARG_INFO(0, uri)
      42             : ZEND_END_ARG_INFO();
      43             : 
      44             : ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_transform_to_xml, 0, 0, 1)
      45             :         ZEND_ARG_INFO(0, doc)
      46             : ZEND_END_ARG_INFO();
      47             : 
      48             : ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_set_parameter, 0, 0, 2)
      49             :         ZEND_ARG_INFO(0, namespace)
      50             :         ZEND_ARG_INFO(0, name)
      51             :         ZEND_ARG_INFO(0, value)
      52             : ZEND_END_ARG_INFO();
      53             : 
      54             : ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_get_parameter, 0, 0, 2)
      55             :         ZEND_ARG_INFO(0, namespace)
      56             :         ZEND_ARG_INFO(0, name)
      57             : ZEND_END_ARG_INFO();
      58             : 
      59             : ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_remove_parameter, 0, 0, 2)
      60             :         ZEND_ARG_INFO(0, namespace)
      61             :         ZEND_ARG_INFO(0, name)
      62             : ZEND_END_ARG_INFO();
      63             : 
      64             : ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_has_exslt_support, 0, 0, 0)
      65             : ZEND_END_ARG_INFO();
      66             : 
      67             : ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_register_php_functions, 0, 0, 0)
      68             :         ZEND_ARG_INFO(0, restrict)
      69             : ZEND_END_ARG_INFO();
      70             : 
      71             : ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_set_profiling, 0, 0, 1)
      72             :         ZEND_ARG_INFO(0, filename)
      73             : ZEND_END_ARG_INFO();
      74             : /* }}} */
      75             : 
      76             : /*
      77             : * class xsl_xsltprocessor 
      78             : *
      79             : * URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#
      80             : * Since: 
      81             : */
      82             : 
      83             : const zend_function_entry php_xsl_xsltprocessor_class_functions[] = {
      84             :         PHP_FALIAS(importStylesheet, xsl_xsltprocessor_import_stylesheet, arginfo_xsl_xsltprocessor_import_stylesheet)
      85             :         PHP_FALIAS(transformToDoc, xsl_xsltprocessor_transform_to_doc, arginfo_xsl_xsltprocessor_transform_to_doc)
      86             :         PHP_FALIAS(transformToUri, xsl_xsltprocessor_transform_to_uri, arginfo_xsl_xsltprocessor_transform_to_uri)
      87             :         PHP_FALIAS(transformToXml, xsl_xsltprocessor_transform_to_xml, arginfo_xsl_xsltprocessor_transform_to_xml)
      88             :         PHP_FALIAS(setParameter, xsl_xsltprocessor_set_parameter, arginfo_xsl_xsltprocessor_set_parameter)
      89             :         PHP_FALIAS(getParameter, xsl_xsltprocessor_get_parameter, arginfo_xsl_xsltprocessor_get_parameter)
      90             :         PHP_FALIAS(removeParameter, xsl_xsltprocessor_remove_parameter, arginfo_xsl_xsltprocessor_remove_parameter)
      91             :         PHP_FALIAS(hasExsltSupport, xsl_xsltprocessor_has_exslt_support, arginfo_xsl_xsltprocessor_has_exslt_support)
      92             :         PHP_FALIAS(registerPHPFunctions, xsl_xsltprocessor_register_php_functions, arginfo_xsl_xsltprocessor_register_php_functions)
      93             :         PHP_FALIAS(setProfiling, xsl_xsltprocessor_set_profiling, arginfo_xsl_xsltprocessor_set_profiling)
      94             :         {NULL, NULL, NULL}
      95             : };
      96             : 
      97             : /* {{{ php_xsl_xslt_string_to_xpathexpr()
      98             :    Translates a string to a XPath Expression */
      99           5 : static char *php_xsl_xslt_string_to_xpathexpr(const char *str TSRMLS_DC)
     100             : {
     101           5 :         const xmlChar *string = (const xmlChar *)str;
     102             : 
     103             :         xmlChar *value;
     104             :         int str_len;
     105             :         
     106           5 :         str_len = xmlStrlen(string) + 3;
     107             :         
     108           5 :         if (xmlStrchr(string, '"')) {
     109           2 :                 if (xmlStrchr(string, '\'')) {
     110           2 :                         php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create XPath expression (string contains both quote and double-quotes)");
     111           2 :                         return NULL;
     112             :                 }
     113           0 :                 value = (xmlChar*) safe_emalloc (str_len, sizeof(xmlChar), 0);
     114           0 :                 snprintf(value, str_len, "'%s'", string);
     115             :         } else {
     116           3 :                 value = (xmlChar*) safe_emalloc (str_len, sizeof(xmlChar), 0);
     117           3 :                 snprintf(value, str_len, "\"%s\"", string);
     118             :         }
     119           3 :         return (char *) value;
     120             : }
     121             : /* }}} */
     122             : 
     123             : /* {{{ php_xsl_xslt_make_params()
     124             :    Translates a PHP array to a libxslt parameters array */
     125          30 : static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS_DC)
     126             : {
     127             :         
     128             :         int parsize;
     129             :         zval **value;
     130          30 :         char *xpath_expr, *string_key = NULL;
     131             :         ulong num_key;
     132          30 :         char **params = NULL;
     133          30 :         int i = 0;
     134             : 
     135          30 :         parsize = (2 * zend_hash_num_elements(parht) + 1) * sizeof(char *);
     136          30 :         params = (char **)safe_emalloc((2 * zend_hash_num_elements(parht) + 1), sizeof(char *), 0);
     137          30 :         memset((char *)params, 0, parsize);
     138             : 
     139          65 :         for (zend_hash_internal_pointer_reset(parht);
     140          35 :                 zend_hash_get_current_data(parht, (void **)&value) == SUCCESS;
     141           5 :                 zend_hash_move_forward(parht)) {
     142             : 
     143           5 :                 if (zend_hash_get_current_key(parht, &string_key, &num_key, 1) != HASH_KEY_IS_STRING) {
     144           0 :                         php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument or parameter array");
     145           0 :                         efree(params);
     146           0 :                         return NULL;
     147             :                 } else {
     148           5 :                         if (Z_TYPE_PP(value) != IS_STRING) {
     149           0 :                                 SEPARATE_ZVAL(value);
     150           0 :                                 convert_to_string(*value);
     151             :                         }
     152             :                         
     153           5 :                         if (!xpath_params) {
     154           5 :                                 xpath_expr = php_xsl_xslt_string_to_xpathexpr(Z_STRVAL_PP(value) TSRMLS_CC);
     155             :                         } else {
     156           0 :                                 xpath_expr = estrndup(Z_STRVAL_PP(value), Z_STRLEN_PP(value));
     157             :                         }
     158           5 :                         if (xpath_expr) {
     159           3 :                                 params[i++] = string_key;
     160           3 :                                 params[i++] = xpath_expr;
     161             :                         } else {
     162           2 :                                 efree(string_key);
     163             :                         }
     164             :                 }
     165             :         }
     166             : 
     167          30 :         params[i++] = NULL;
     168             : 
     169          30 :         return params;
     170             : }
     171             : /* }}} */
     172             : 
     173          17 : static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int type) /* {{{ */
     174             : {
     175             :         xsltTransformContextPtr tctxt;
     176             :         zval **args;
     177             :         zval *retval;
     178             :         int result, i, ret;
     179          17 :         int error = 0;
     180             :         zend_fcall_info fci;
     181             :         zval handler;
     182             :         xmlXPathObjectPtr obj;
     183             :         char *str;
     184          17 :         char *callable = NULL;
     185             :         xsl_object *intern;
     186             :         
     187             :         TSRMLS_FETCH();
     188             : 
     189          17 :         if (! zend_is_executing(TSRMLS_C)) {
     190           0 :                 xsltGenericError(xsltGenericErrorContext,
     191             :                 "xsltExtFunctionTest: Function called from outside of PHP\n");
     192           0 :                 error = 1;
     193             :         } else {
     194          17 :                 tctxt = xsltXPathGetTransformContext(ctxt);
     195          17 :                 if (tctxt == NULL) {
     196           0 :                         xsltGenericError(xsltGenericErrorContext,
     197             :                         "xsltExtFunctionTest: failed to get the transformation context\n");
     198           0 :                         error = 1;
     199             :                 } else {
     200          17 :                         intern = (xsl_object *) tctxt->_private;
     201          17 :                         if (intern == NULL) {
     202           0 :                                 xsltGenericError(xsltGenericErrorContext,
     203             :                                 "xsltExtFunctionTest: failed to get the internal object\n");
     204           0 :                                 error = 1;
     205             :                         }
     206          17 :                         else if (intern->registerPhpFunctions == 0) {
     207           0 :                                 xsltGenericError(xsltGenericErrorContext,
     208             :                                 "xsltExtFunctionTest: PHP Object did not register PHP functions\n");
     209           0 :                                 error = 1;
     210             :                         }
     211             :                 }
     212             :         }
     213             :         
     214          17 :         if (error == 1) {
     215           0 :                 for (i = nargs - 1; i >= 0; i--) {
     216           0 :                         obj = valuePop(ctxt);
     217           0 :                         xmlXPathFreeObject(obj);
     218             :                 }
     219           0 :                 return;
     220             :         }
     221             :                 
     222          17 :         fci.param_count = nargs - 1;
     223          17 :         if (fci.param_count > 0) {
     224          14 :                 fci.params = safe_emalloc(fci.param_count, sizeof(zval**), 0);
     225          14 :                 args = safe_emalloc(fci.param_count, sizeof(zval *), 0);
     226             :         }
     227             :         /* Reverse order to pop values off ctxt stack */
     228          32 :         for (i = nargs - 2; i >= 0; i--) {
     229          15 :                 obj = valuePop(ctxt);
     230          15 :                 MAKE_STD_ZVAL(args[i]);
     231          15 :                 switch (obj->type) {
     232             :                         case XPATH_STRING:
     233          12 :                                 ZVAL_STRING(args[i],  obj->stringval, 1);
     234          12 :                                 break;
     235             :                         case XPATH_BOOLEAN:
     236           0 :                                 ZVAL_BOOL(args[i],  obj->boolval);
     237           0 :                                 break;
     238             :                         case XPATH_NUMBER:
     239           0 :                                 ZVAL_DOUBLE(args[i], obj->floatval);
     240           0 :                                 break;
     241             :                         case XPATH_NODESET:
     242           3 :                                 if (type == 1) {
     243           1 :                                         str = xmlXPathCastToString(obj);
     244           1 :                                         ZVAL_STRING(args[i], str, 1);
     245           1 :                                         xmlFree(str);
     246           2 :                                 } else if (type == 2) {
     247             :                                         int j;
     248           2 :                                         dom_object *domintern = (dom_object *)intern->doc;
     249           2 :                                         array_init(args[i]);
     250           2 :                                         if (obj->nodesetval && obj->nodesetval->nodeNr > 0) {
     251           4 :                                                 for (j = 0; j < obj->nodesetval->nodeNr; j++) {
     252           2 :                                                         xmlNodePtr node = obj->nodesetval->nodeTab[j];
     253             :                                                         zval *child;
     254           2 :                                                         MAKE_STD_ZVAL(child);
     255             :                                                         /* not sure, if we need this... it's copied from xpath.c */
     256           2 :                                                         if (node->type == XML_NAMESPACE_DECL) {
     257             :                                                                 xmlNsPtr curns;
     258             :                                                                 xmlNodePtr nsparent;
     259             :                                                                 
     260           0 :                                                                 nsparent = node->_private;
     261           0 :                                                                 curns = xmlNewNs(NULL, node->name, NULL);
     262           0 :                                                                 if (node->children) {
     263           0 :                                                                         curns->prefix = xmlStrdup((char *) node->children);
     264             :                                                                 }
     265           0 :                                                                 if (node->children) {
     266           0 :                                                                         node = xmlNewDocNode(node->doc, NULL, (char *) node->children, node->name);
     267             :                                                                 } else {
     268           0 :                                                                         node = xmlNewDocNode(node->doc, NULL, "xmlns", node->name);
     269             :                                                                 }
     270           0 :                                                                 node->type = XML_NAMESPACE_DECL;
     271           0 :                                                                 node->parent = nsparent;
     272           0 :                                                                 node->ns = curns;
     273             :                                                         }
     274           2 :                                                         child = php_dom_create_object(node, &ret, NULL, child, domintern TSRMLS_CC);
     275           2 :                                                         add_next_index_zval(args[i], child);
     276             :                                                 }
     277             :                                         }
     278             :                                 }
     279           3 :                                 break;
     280             :                         default:
     281           0 :                                 str = xmlXPathCastToString(obj);
     282           0 :                                 ZVAL_STRING(args[i], str, 1);
     283           0 :                                 xmlFree(str);
     284             :                 }
     285          15 :                 xmlXPathFreeObject(obj);
     286          15 :                 fci.params[i] = &args[i];
     287             :         }
     288             :         
     289          17 :         fci.size = sizeof(fci);
     290          17 :         fci.function_table = EG(function_table);
     291             :         
     292          17 :         obj = valuePop(ctxt);
     293          17 :         if (obj->stringval == NULL) {
     294           1 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Handler name must be a string");
     295           1 :                 xmlXPathFreeObject(obj);
     296           1 :                 if (fci.param_count > 0) {
     297           2 :                         for (i = 0; i < nargs - 1; i++) {
     298           1 :                                 zval_ptr_dtor(&args[i]);
     299             :                         }
     300           1 :                         efree(args);
     301           1 :                         efree(fci.params);
     302             :                 }
     303           1 :                 return; 
     304             :         }
     305          16 :         INIT_PZVAL(&handler);
     306          16 :         ZVAL_STRING(&handler, obj->stringval, 1);
     307          16 :         xmlXPathFreeObject(obj);
     308             :         
     309          16 :         fci.function_name = &handler;
     310          16 :         fci.symbol_table = NULL;
     311          16 :         fci.object_ptr = NULL;
     312          16 :         fci.retval_ptr_ptr = &retval;
     313          16 :         fci.no_separation = 0;
     314             :         /*fci.function_handler_cache = &function_ptr;*/
     315          16 :         if (!zend_make_callable(&handler, &callable TSRMLS_CC)) {
     316           1 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", callable);
     317             :                 
     318          16 :         } else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable, strlen(callable) + 1) == 0) { 
     319           2 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not allowed to call handler '%s()'", callable);
     320             :                 /* Push an empty string, so that we at least have an xslt result... */
     321           2 :                 valuePush(ctxt, xmlXPathNewString(""));
     322             :         } else {
     323          12 :                 result = zend_call_function(&fci, NULL TSRMLS_CC);
     324          12 :                 if (result == FAILURE) {
     325           0 :                         if (Z_TYPE(handler) == IS_STRING) {
     326           0 :                                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(&handler));
     327             :                         }
     328             :                 /* retval is == NULL, when an exception occured, don't report anything, because PHP itself will handle that */
     329          12 :                 } else if (retval == NULL) {
     330             :                 } else {
     331          14 :                         if (retval->type == IS_OBJECT && instanceof_function( Z_OBJCE_P(retval), dom_node_class_entry TSRMLS_CC)) {
     332             :                                 xmlNode *nodep;
     333             :                                 dom_object *obj;
     334           2 :                                 if (intern->node_list == NULL) {
     335           1 :                                         ALLOC_HASHTABLE(intern->node_list);
     336           1 :                                         zend_hash_init(intern->node_list, 0, NULL, ZVAL_PTR_DTOR, 0);
     337             :                                 }
     338           2 :                                 zval_add_ref(&retval);
     339           2 :                                 zend_hash_next_index_insert(intern->node_list, &retval, sizeof(zval *), NULL);
     340           2 :                                 obj = (dom_object *)zend_object_store_get_object(retval TSRMLS_CC);
     341           2 :                                 nodep = dom_object_get_node(obj);
     342           2 :                                 valuePush(ctxt, xmlXPathNewNodeSet(nodep));
     343          10 :                         } else if (retval->type == IS_BOOL) {
     344           0 :                                 valuePush(ctxt, xmlXPathNewBoolean(retval->value.lval));
     345          10 :                         } else if (retval->type == IS_OBJECT) {
     346           1 :                                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "A PHP Object cannot be converted to a XPath-string");
     347           1 :                                 valuePush(ctxt, xmlXPathNewString(""));
     348             :                         } else {
     349           9 :                                 convert_to_string_ex(&retval);
     350           9 :                                 valuePush(ctxt, xmlXPathNewString( Z_STRVAL_P(retval)));
     351             :                         }
     352          12 :                         zval_ptr_dtor(&retval);
     353             :                 }
     354             :         }
     355          15 :         efree(callable);
     356          15 :         zval_dtor(&handler);
     357          15 :         if (fci.param_count > 0) {
     358          27 :                 for (i = 0; i < nargs - 1; i++) {
     359          14 :                         zval_ptr_dtor(&args[i]);
     360             :                 }
     361          13 :                 efree(args);
     362          13 :                 efree(fci.params);
     363             :         }
     364             : }
     365             : /* }}} */
     366             : 
     367           1 : void xsl_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs) /* {{{ */
     368             : {
     369           1 :         xsl_ext_function_php(ctxt, nargs, 1);
     370           1 : }
     371             : /* }}} */
     372             : 
     373          16 : void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs) /* {{{ */
     374             : {
     375          16 :         xsl_ext_function_php(ctxt, nargs, 2);
     376          15 : }
     377             : /* }}} */
     378             : 
     379             : /* {{{ proto void xsl_xsltprocessor_import_stylesheet(domdocument doc);
     380             : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#
     381             : Since: 
     382             : */
     383          31 : PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
     384             : {
     385          31 :         zval *id, *docp = NULL;
     386          31 :         xmlDoc *doc = NULL, *newdoc = NULL;
     387             :         xsltStylesheetPtr sheetp, oldsheetp;
     388             :         xsl_object *intern;
     389          31 :         int prevSubstValue, prevExtDtdValue, clone_docu = 0;
     390          31 :         xmlNode *nodep = NULL;
     391             :         zend_object_handlers *std_hnd;
     392             :         zval *cloneDocu, *member;
     393             :         
     394          31 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oo", &id, xsl_xsltprocessor_class_entry, &docp) == FAILURE) {
     395           0 :                 RETURN_FALSE;
     396             :         }
     397             : 
     398          31 :         nodep = php_libxml_import_node(docp TSRMLS_CC);
     399             :         
     400          31 :         if (nodep) {
     401          31 :                 doc = nodep->doc;
     402             :         }
     403          31 :         if (doc == NULL) {
     404           0 :                 php_error(E_WARNING, "Invalid Document");
     405           0 :                 RETURN_FALSE;
     406             :         }
     407             : 
     408             :         /* libxslt uses _private, so we must copy the imported 
     409             :         stylesheet document otherwise the node proxies will be a mess */
     410          31 :         newdoc = xmlCopyDoc(doc, 1);
     411          31 :         xmlNodeSetBase((xmlNodePtr) newdoc, (xmlChar *)doc->URL);
     412          31 :         prevSubstValue = xmlSubstituteEntitiesDefault(1);
     413          31 :         prevExtDtdValue = xmlLoadExtDtdDefaultValue;
     414          31 :         xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
     415             : 
     416          31 :         sheetp = xsltParseStylesheetDoc(newdoc);
     417          31 :         xmlSubstituteEntitiesDefault(prevSubstValue);
     418          31 :         xmlLoadExtDtdDefaultValue = prevExtDtdValue;
     419             : 
     420          31 :         if (!sheetp) {
     421           0 :                 xmlFreeDoc(newdoc);
     422           0 :                 RETURN_FALSE;
     423             :         }
     424             : 
     425          31 :         intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); 
     426             : 
     427          31 :         std_hnd = zend_get_std_object_handlers();
     428          31 :         MAKE_STD_ZVAL(member);
     429          31 :         ZVAL_STRING(member, "cloneDocument", 0);
     430          31 :         cloneDocu = std_hnd->read_property(id, member, BP_VAR_IS TSRMLS_CC);
     431          31 :         if (Z_TYPE_P(cloneDocu) != IS_NULL) {
     432           0 :                 convert_to_long(cloneDocu);
     433           0 :                 clone_docu = Z_LVAL_P(cloneDocu);
     434             :         }
     435          31 :         efree(member);
     436          31 :         if (clone_docu == 0) {
     437             :                 /* check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation */
     438          31 :                 nodep = xmlDocGetRootElement(sheetp->doc);
     439          31 :                 if (nodep && (nodep = nodep->children)) {
     440         149 :                         while (nodep) {
     441          88 :                                 if (nodep->type == XML_ELEMENT_NODE && xmlStrEqual(nodep->name, "key") && xmlStrEqual(nodep->ns->href, XSLT_NAMESPACE)) {
     442           1 :                                         intern->hasKeys = 1;
     443           1 :                                         break;
     444             :                                 }
     445          87 :                                 nodep = nodep->next;
     446             :                         }
     447             :                 }
     448             :         } else {
     449           0 :                 intern->hasKeys = clone_docu;
     450             :         }
     451             : 
     452          31 :         if ((oldsheetp = (xsltStylesheetPtr)intern->ptr)) { 
     453             :                 /* free wrapper */
     454           0 :                 if (((xsltStylesheetPtr) intern->ptr)->_private != NULL) {
     455           0 :                         ((xsltStylesheetPtr) intern->ptr)->_private = NULL;   
     456             :                 }
     457           0 :                 xsltFreeStylesheet((xsltStylesheetPtr) intern->ptr);
     458           0 :                 intern->ptr = NULL;
     459             :         }
     460             : 
     461          31 :         php_xsl_set_object(id, sheetp TSRMLS_CC);
     462          31 :         RETVAL_TRUE;
     463             : }
     464             : /* }}} end xsl_xsltprocessor_import_stylesheet */
     465             : 
     466          30 : static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStylesheetPtr style, zval *docp TSRMLS_DC) /* {{{ */
     467             : {
     468             :         xmlDocPtr newdocp;
     469          30 :         xmlDocPtr doc = NULL;
     470          30 :         xmlNodePtr node = NULL;
     471             :         xsltTransformContextPtr ctxt;
     472             :         php_libxml_node_object *object;
     473          30 :         char **params = NULL;
     474             :         int clone;
     475             :         zval *doXInclude, *member;
     476             :         zend_object_handlers *std_hnd;
     477             :         FILE *f;
     478          30 :         int secPrefsError = 0;
     479             :         int secPrefsValue;
     480          30 :         xsltSecurityPrefsPtr secPrefs = NULL;
     481             : 
     482          30 :         node = php_libxml_import_node(docp TSRMLS_CC);
     483             :         
     484          30 :         if (node) {
     485          30 :                 doc = node->doc;
     486             :         }
     487          30 :         if (doc == NULL) {
     488           0 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Document");
     489           0 :                 return NULL;
     490             :         }
     491             : 
     492          30 :         if (style == NULL) {
     493           0 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stylesheet associated to this object");
     494           0 :                 return NULL;
     495             :         }
     496             :         
     497          30 :         if (intern->profiling) {
     498           0 :                 if (php_check_open_basedir(intern->profiling TSRMLS_CC)) {
     499           0 :                         f = NULL;
     500             :                 } else {
     501           0 :                         f = VCWD_FOPEN(intern->profiling, "w");
     502             :                 }
     503             :         } else {
     504          30 :                 f = NULL;
     505             :         }
     506             :         
     507          30 :         if (intern->parameter) {
     508          30 :                 params = php_xsl_xslt_make_params(intern->parameter, 0 TSRMLS_CC);
     509             :         }
     510             : 
     511          30 :         intern->doc = emalloc(sizeof(php_libxml_node_object));
     512          30 :         memset(intern->doc, 0, sizeof(php_libxml_node_object));
     513             : 
     514          30 :         if (intern->hasKeys == 1) {
     515           1 :                 doc = xmlCopyDoc(doc, 1);
     516             :         } else {
     517          29 :                 object = (php_libxml_node_object *)zend_object_store_get_object(docp TSRMLS_CC);
     518          29 :                 intern->doc->document = object->document;
     519             :         }
     520             : 
     521          30 :         php_libxml_increment_doc_ref(intern->doc, doc TSRMLS_CC);
     522             : 
     523          30 :         ctxt = xsltNewTransformContext(style, doc);
     524          30 :         ctxt->_private = (void *) intern;
     525             : 
     526          30 :         std_hnd = zend_get_std_object_handlers();
     527             : 
     528          30 :         MAKE_STD_ZVAL(member);
     529          30 :         ZVAL_STRING(member, "doXInclude", 0);
     530          30 :         doXInclude = std_hnd->read_property(id, member, BP_VAR_IS TSRMLS_CC);
     531          30 :         if (Z_TYPE_P(doXInclude) != IS_NULL) {
     532           0 :                 convert_to_long(doXInclude);
     533           0 :                 ctxt->xinclude = Z_LVAL_P(doXInclude);
     534             :         }
     535          30 :         efree(member);
     536             : 
     537             :         
     538          30 :         secPrefsValue = INI_INT("xsl.security_prefs");
     539             :         
     540             :         /* if securityPrefs is set to NONE, we don't have to do any checks, but otherwise... */
     541          30 :         if (secPrefsValue != XSL_SECPREF_NONE) {
     542          29 :                 secPrefs = xsltNewSecurityPrefs(); 
     543          29 :                 if (secPrefsValue & XSL_SECPREF_READ_FILE ) { 
     544           0 :                         if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityForbid)) { 
     545           0 :                                 secPrefsError = 1;
     546             :                         }
     547             :                 }
     548          29 :                 if (secPrefsValue & XSL_SECPREF_WRITE_FILE ) { 
     549          29 :                         if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_WRITE_FILE, xsltSecurityForbid)) { 
     550           0 :                                 secPrefsError = 1;
     551             :                         }
     552             :                 }
     553          29 :                 if (secPrefsValue & XSL_SECPREF_CREATE_DIRECTORY ) { 
     554          29 :                         if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_CREATE_DIRECTORY, xsltSecurityForbid)) { 
     555           0 :                                 secPrefsError = 1;
     556             :                         }
     557             :                 }
     558          29 :                 if (secPrefsValue & XSL_SECPREF_READ_NETWORK) { 
     559           0 :                         if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityForbid)) { 
     560           0 :                                 secPrefsError = 1;
     561             :                         }
     562             :                 }
     563          29 :                 if (secPrefsValue & XSL_SECPREF_WRITE_NETWORK) { 
     564          29 :                         if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_WRITE_NETWORK, xsltSecurityForbid)) { 
     565           0 :                                 secPrefsError = 1;
     566             :                         }
     567             :                 }
     568             :         
     569          29 :                 if (0 != xsltSetCtxtSecurityPrefs(secPrefs, ctxt)) { 
     570           0 :                         secPrefsError = 1;
     571             :                 }
     572             :         }
     573             :         
     574          30 :         if (secPrefsError == 1) {
     575           0 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't set libxslt security properties, not doing transformation for security reasons");
     576             :         } else {
     577          30 :                 newdocp = xsltApplyStylesheetUser(style, doc, (const char**) params,  NULL, f, ctxt);
     578             :         }
     579          29 :         if (f) {
     580           0 :                 fclose(f);
     581             :         }
     582             :         
     583          29 :         xsltFreeTransformContext(ctxt);
     584          29 :         if (secPrefs) {
     585          28 :                 xsltFreeSecurityPrefs(secPrefs);
     586             :         }
     587             : 
     588          29 :         if (intern->node_list != NULL) {
     589           1 :                 zend_hash_destroy(intern->node_list);
     590           1 :                 FREE_HASHTABLE(intern->node_list);   
     591           1 :                 intern->node_list = NULL;
     592             :         }
     593             : 
     594          29 :         php_libxml_decrement_doc_ref(intern->doc TSRMLS_CC);
     595          29 :         efree(intern->doc);
     596          29 :         intern->doc = NULL;
     597             : 
     598          29 :         if (params) {
     599          29 :                 clone = 0;
     600          64 :                 while(params[clone]) {
     601           6 :                         efree(params[clone++]);
     602             :                 }
     603          29 :                 efree(params);
     604             :         }
     605             : 
     606          29 :         return newdocp;
     607             : 
     608             : }
     609             : /* }}} */
     610             : 
     611             : /* {{{ proto domdocument xsl_xsltprocessor_transform_to_doc(domnode doc);
     612             : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#
     613             : Since: 
     614             : */
     615           2 : PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc)
     616             : {
     617           2 :         zval *id, *rv = NULL, *docp = NULL;
     618             :         xmlDoc *newdocp;
     619             :         xsltStylesheetPtr sheetp;
     620           2 :         int ret, ret_class_len=0;
     621           2 :         char *ret_class = NULL;
     622             :         xsl_object *intern;
     623             : 
     624           2 :         id = getThis();
     625           2 :         intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     626           2 :         sheetp = (xsltStylesheetPtr) intern->ptr;
     627             : 
     628           2 :         if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|s!", &docp, &ret_class, &ret_class_len) == FAILURE) {
     629           0 :                 RETURN_FALSE;
     630             :         }
     631             : 
     632           2 :         newdocp = php_xsl_apply_stylesheet(id, intern, sheetp, docp TSRMLS_CC);
     633             : 
     634           1 :         if (newdocp) {
     635           1 :                 if (ret_class) {
     636             :                         int found;
     637             :                         char *curclass_name;
     638             :                         zend_class_entry *curce, **ce;
     639             :                         php_libxml_node_object *interndoc;
     640             : 
     641           0 :                         curce = Z_OBJCE_P(docp);
     642           0 :                         curclass_name = curce->name;
     643           0 :                         while (curce->parent != NULL) {
     644           0 :                                 curce = curce->parent;
     645             :                         }
     646             : 
     647           0 :                         found = zend_lookup_class(ret_class, ret_class_len, &ce TSRMLS_CC);
     648           0 :                         if ((found != SUCCESS) || !instanceof_function(*ce, curce TSRMLS_CC)) {
     649           0 :                                 xmlFreeDoc(newdocp);
     650           0 :                                 php_error_docref(NULL TSRMLS_CC, E_WARNING, 
     651             :                                         "Expecting class compatible with %s, '%s' given", curclass_name, ret_class);
     652           0 :                                 RETURN_FALSE;
     653             :                         }
     654             : 
     655           0 :                         object_init_ex(return_value, *ce);
     656             :                 
     657           0 :                         interndoc = (php_libxml_node_object *)zend_objects_get_address(return_value TSRMLS_CC);
     658           0 :                         php_libxml_increment_doc_ref(interndoc, newdocp TSRMLS_CC);
     659           0 :                         php_libxml_increment_node_ptr(interndoc, (xmlNodePtr)newdocp, (void *)interndoc TSRMLS_CC);
     660             :                 } else {
     661           1 :                         DOM_RET_OBJ(rv, (xmlNodePtr) newdocp, &ret, NULL);
     662             :                 }
     663             :         } else {
     664           0 :                 RETURN_FALSE;
     665             :         }
     666             :         
     667             : }
     668             : /* }}} end xsl_xsltprocessor_transform_to_doc */
     669             : 
     670             : /* {{{ proto int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri);
     671             : */
     672           1 : PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
     673             : {
     674           1 :         zval *id, *docp = NULL;
     675             :         xmlDoc *newdocp;
     676             :         xsltStylesheetPtr sheetp;
     677             :         int ret, uri_len;
     678             :         char *uri;
     679             :         xsl_object *intern;
     680             :         
     681           1 :         id = getThis();
     682           1 :         intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     683           1 :         sheetp = (xsltStylesheetPtr) intern->ptr;
     684             : 
     685           1 :         if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os", &docp, &uri, &uri_len) == FAILURE) {
     686           0 :                 RETURN_FALSE;
     687             :         }
     688             : 
     689           1 :         newdocp = php_xsl_apply_stylesheet(id, intern, sheetp, docp TSRMLS_CC);
     690             : 
     691           1 :         ret = -1;
     692           1 :         if (newdocp) {
     693           1 :                 if (strlen(uri) != uri_len) {
     694           0 :                         xmlFreeDoc(newdocp);
     695           0 :                         RETURN_FALSE;
     696             :                 }
     697           1 :                 ret = xsltSaveResultToFilename(uri, newdocp, sheetp, 0);
     698           1 :                 xmlFreeDoc(newdocp);
     699             :         }
     700             : 
     701           1 :         RETVAL_LONG(ret);
     702             : }
     703             : /* }}} end xsl_xsltprocessor_transform_to_uri */
     704             : 
     705             : /* {{{ proto string xsl_xsltprocessor_transform_to_xml(domdocument doc);
     706             : */
     707          27 : PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml)
     708             : {
     709          27 :         zval *id, *docp = NULL;
     710             :         xmlDoc *newdocp;
     711             :         xsltStylesheetPtr sheetp;
     712             :         int ret;
     713             :         xmlChar *doc_txt_ptr;
     714             :         int doc_txt_len;
     715             :         xsl_object *intern;
     716             :         
     717          27 :         id = getThis();
     718          27 :         intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     719          27 :         sheetp = (xsltStylesheetPtr) intern->ptr;
     720             : 
     721          27 :         if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &docp) == FAILURE) {
     722           0 :                 RETURN_FALSE;
     723             :         }
     724             : 
     725          27 :         newdocp = php_xsl_apply_stylesheet(id, intern, sheetp, docp TSRMLS_CC);
     726             : 
     727          27 :         ret = -1;
     728          27 :         if (newdocp) {
     729          25 :                 ret = xsltSaveResultToString(&doc_txt_ptr, &doc_txt_len, newdocp, sheetp);
     730          25 :                 if (doc_txt_ptr && doc_txt_len) {
     731          20 :                         RETVAL_STRINGL(doc_txt_ptr, doc_txt_len, 1);
     732          20 :                         xmlFree(doc_txt_ptr);
     733             :                 }
     734          25 :                 xmlFreeDoc(newdocp);
     735             :         }
     736             : 
     737          27 :         if (ret < 0) {
     738           2 :                 RETURN_FALSE;
     739             :         }
     740             : }
     741             : /* }}} end xsl_xsltprocessor_transform_to_xml */
     742             : 
     743             : /* {{{ proto bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value]);
     744             : */
     745           7 : PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
     746             : {
     747             :  
     748             :         zval *id;
     749             :         zval *array_value, **entry, *new_string;
     750             :         xsl_object *intern;
     751             :         char *string_key, *name, *value, *namespace;
     752             :         ulong idx;
     753             :         int string_key_len, namespace_len, name_len, value_len;
     754           7 :         DOM_GET_THIS(id);
     755             : 
     756           7 :         if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sa", &namespace, &namespace_len, &array_value) == SUCCESS) {
     757           2 :                 intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     758           2 :                 zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value));
     759             : 
     760           6 :                 while (zend_hash_get_current_data(Z_ARRVAL_P(array_value), (void **)&entry) == SUCCESS) {
     761           6 :                         SEPARATE_ZVAL(entry);
     762           6 :                         convert_to_string_ex(entry);
     763             :                         
     764           3 :                         if (zend_hash_get_current_key_ex(Z_ARRVAL_P(array_value), &string_key, &string_key_len, &idx, 0, NULL) != HASH_KEY_IS_STRING) {
     765           1 :                                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter array");
     766           1 :                                 RETURN_FALSE;
     767             :                         }
     768             :                         
     769           2 :                         ALLOC_ZVAL(new_string);
     770           2 :                         Z_ADDREF_PP(entry);
     771           4 :                         COPY_PZVAL_TO_ZVAL(*new_string, *entry);
     772             :                         
     773           2 :                         zend_hash_update(intern->parameter, string_key, string_key_len, &new_string, sizeof(zval*), NULL);
     774           2 :                         zend_hash_move_forward(Z_ARRVAL_P(array_value));
     775             :                 }
     776           1 :                 RETURN_TRUE;
     777             : 
     778           5 :         } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sss", &namespace, &namespace_len, &name, &name_len, &value, &value_len) == SUCCESS) {
     779             :                 
     780           5 :                 intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     781             :                 
     782           5 :                 MAKE_STD_ZVAL(new_string);
     783           5 :                 ZVAL_STRING(new_string, value, 1);
     784             :                 
     785           5 :                 zend_hash_update(intern->parameter, name, name_len + 1, &new_string, sizeof(zval*), NULL);
     786           5 :                 RETURN_TRUE;
     787             :         } else {
     788           0 :                 WRONG_PARAM_COUNT;
     789             :         }
     790             :         
     791             : }
     792             : /* }}} end xsl_xsltprocessor_set_parameter */
     793             : 
     794             : /* {{{ proto string xsl_xsltprocessor_get_parameter(string namespace, string name);
     795             : */
     796           6 : PHP_FUNCTION(xsl_xsltprocessor_get_parameter)
     797             : {
     798             :         zval *id;
     799           6 :         int name_len = 0, namespace_len = 0;
     800             :         char *name, *namespace;
     801             :         zval **value;
     802             :         xsl_object *intern;
     803             : 
     804           6 :         DOM_GET_THIS(id);
     805             :         
     806           6 :         if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &namespace, &namespace_len, &name, &name_len) == FAILURE) {
     807           3 :                 RETURN_FALSE;
     808             :         }
     809           3 :         intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     810           3 :         if ( zend_hash_find(intern->parameter, name, name_len + 1,  (void**) &value) == SUCCESS) {
     811           1 :                 convert_to_string_ex(value);
     812           1 :                 RETVAL_STRING(Z_STRVAL_PP(value),1);
     813             :         } else {
     814           2 :                 RETURN_FALSE;
     815             :         }
     816             : }
     817             : /* }}} end xsl_xsltprocessor_get_parameter */
     818             : 
     819             : /* {{{ proto bool xsl_xsltprocessor_remove_parameter(string namespace, string name);
     820             : */
     821           5 : PHP_FUNCTION(xsl_xsltprocessor_remove_parameter)
     822             : {
     823             :         zval *id;
     824           5 :         int name_len = 0, namespace_len = 0;
     825             :         char *name, *namespace;
     826             :         xsl_object *intern;
     827             : 
     828           5 :         DOM_GET_THIS(id);
     829             :         
     830           5 :         if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &namespace, &namespace_len, &name, &name_len) == FAILURE) {
     831           3 :                 RETURN_FALSE;
     832             :         }
     833           2 :         intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     834           2 :         if ( zend_hash_del(intern->parameter, name, name_len + 1) == SUCCESS) {
     835           1 :                 RETURN_TRUE;
     836             :         } else {
     837           1 :                 RETURN_FALSE;
     838             :         }
     839             : }
     840             : /* }}} end xsl_xsltprocessor_remove_parameter */
     841             : 
     842             : /* {{{ proto void xsl_xsltprocessor_register_php_functions([mixed $restrict]);
     843             : */
     844          16 : PHP_FUNCTION(xsl_xsltprocessor_register_php_functions)
     845             : {
     846             :         zval *id;
     847             :         xsl_object *intern;
     848             :         zval *array_value, **entry, *new_string;
     849          16 :         int  name_len = 0;
     850             :         char *name;
     851             : 
     852          16 :         DOM_GET_THIS(id);
     853             :         
     854          16 :         if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "a",  &array_value) == SUCCESS) {
     855           5 :                 intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     856           5 :                 zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value));
     857             : 
     858          15 :                 while (zend_hash_get_current_data(Z_ARRVAL_P(array_value), (void **)&entry) == SUCCESS) {
     859          10 :                         SEPARATE_ZVAL(entry);
     860           5 :                         convert_to_string_ex(entry);
     861             :                         
     862           5 :                         MAKE_STD_ZVAL(new_string);
     863           5 :                         ZVAL_LONG(new_string,1);
     864             :                 
     865           5 :                         zend_hash_update(intern->registered_phpfunctions, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &new_string, sizeof(zval*), NULL);
     866           5 :                         zend_hash_move_forward(Z_ARRVAL_P(array_value));
     867             :                 }
     868           5 :                 intern->registerPhpFunctions = 2;
     869             : 
     870          11 :         } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s",  &name, &name_len) == SUCCESS) {
     871           6 :                 intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     872             :                 
     873           6 :                 MAKE_STD_ZVAL(new_string);
     874           6 :                 ZVAL_LONG(new_string,1);
     875           6 :                 zend_hash_update(intern->registered_phpfunctions, name, name_len + 1, &new_string, sizeof(zval*), NULL);
     876           6 :                 intern->registerPhpFunctions = 2;
     877             :                 
     878             :         } else {
     879           5 :                 intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     880           5 :                 intern->registerPhpFunctions = 1;
     881             :         }
     882             :         
     883             : }
     884             : /* }}} end xsl_xsltprocessor_register_php_functions(); */
     885             : 
     886             : /* {{{ proto bool xsl_xsltprocessor_set_profiling(string filename) */
     887           0 : PHP_FUNCTION(xsl_xsltprocessor_set_profiling)
     888             : {
     889             :         zval *id;
     890             :         xsl_object *intern;
     891           0 :         char *filename = NULL;
     892             :         int filename_len;
     893           0 :         DOM_GET_THIS(id);
     894             : 
     895           0 :         if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s!", &filename, &filename_len) == SUCCESS) {
     896           0 :                 intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
     897           0 :                 if (intern->profiling) {
     898           0 :                         efree(intern->profiling);
     899             :                 }
     900           0 :                 if (filename != NULL && strlen(filename) == filename_len) {
     901           0 :                         intern->profiling = estrndup(filename,filename_len);
     902             :                 } else {
     903           0 :                         intern->profiling = NULL;
     904             :                 }
     905           0 :                 RETURN_TRUE;
     906             :         } else {
     907           0 :                 WRONG_PARAM_COUNT;
     908             :         }
     909             : }
     910             : /* }}} end xsl_xsltprocessor_set_profiling */
     911             : 
     912             : /* {{{ proto bool xsl_xsltprocessor_has_exslt_support();
     913             : */
     914           1 : PHP_FUNCTION(xsl_xsltprocessor_has_exslt_support)
     915             : {
     916             : #if HAVE_XSL_EXSLT
     917           1 :         RETURN_TRUE;
     918             : #else
     919             :         RETURN_FALSE;
     920             : #endif
     921             : }
     922             : /* }}} end xsl_xsltprocessor_has_exslt_support(); */
     923             : 
     924             : /*
     925             :  * Local variables:
     926             :  * tab-width: 4
     927             :  * c-basic-offset: 4
     928             :  * End:
     929             :  * vim600: sw=4 ts=4 fdm=marker
     930             :  * vim<600: sw=4 ts=4
     931             :  */

Generated by: LCOV version 1.10

Generated at Sun, 27 Jul 2014 12:58:39 +0000 (3 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.