version 1.1.1.1, 2012/02/21 23:48:05
|
version 1.1.1.5, 2014/06/15 20:04:01
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| PHP Version 5 | |
| PHP Version 5 | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1997-2012 The PHP Group | | | Copyright (c) 1997-2014 The PHP Group | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 3.01 of the PHP license, | |
| This source file is subject to version 3.01 of the PHP license, | |
| that is bundled with this package in the file LICENSE, and is | |
| that is bundled with this package in the file LICENSE, and is | |
Line 71 ZEND_END_ARG_INFO();
|
Line 71 ZEND_END_ARG_INFO();
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_set_profiling, 0, 0, 1) |
ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_set_profiling, 0, 0, 1) |
ZEND_ARG_INFO(0, filename) |
ZEND_ARG_INFO(0, filename) |
ZEND_END_ARG_INFO(); |
ZEND_END_ARG_INFO(); |
|
|
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_set_security_prefs, 0, 0, 1) |
|
ZEND_ARG_INFO(0, securityPrefs) |
|
ZEND_END_ARG_INFO(); |
|
|
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_get_security_prefs, 0, 0, 0) |
|
ZEND_END_ARG_INFO(); |
/* }}} */ |
/* }}} */ |
|
|
/* |
/* |
Line 91 const zend_function_entry php_xsl_xsltprocessor_class_
|
Line 98 const zend_function_entry php_xsl_xsltprocessor_class_
|
PHP_FALIAS(hasExsltSupport, xsl_xsltprocessor_has_exslt_support, arginfo_xsl_xsltprocessor_has_exslt_support) |
PHP_FALIAS(hasExsltSupport, xsl_xsltprocessor_has_exslt_support, arginfo_xsl_xsltprocessor_has_exslt_support) |
PHP_FALIAS(registerPHPFunctions, xsl_xsltprocessor_register_php_functions, arginfo_xsl_xsltprocessor_register_php_functions) |
PHP_FALIAS(registerPHPFunctions, xsl_xsltprocessor_register_php_functions, arginfo_xsl_xsltprocessor_register_php_functions) |
PHP_FALIAS(setProfiling, xsl_xsltprocessor_set_profiling, arginfo_xsl_xsltprocessor_set_profiling) |
PHP_FALIAS(setProfiling, xsl_xsltprocessor_set_profiling, arginfo_xsl_xsltprocessor_set_profiling) |
|
PHP_FALIAS(setSecurityPrefs, xsl_xsltprocessor_set_security_prefs, arginfo_xsl_xsltprocessor_set_security_prefs) |
|
PHP_FALIAS(getSecurityPrefs, xsl_xsltprocessor_get_security_prefs, arginfo_xsl_xsltprocessor_get_security_prefs) |
{NULL, NULL, NULL} |
{NULL, NULL, NULL} |
}; |
}; |
|
|
Line 270 static void xsl_ext_function_php(xmlXPathParserContext
|
Line 279 static void xsl_ext_function_php(xmlXPathParserContext
|
node->type = XML_NAMESPACE_DECL; |
node->type = XML_NAMESPACE_DECL; |
node->parent = nsparent; |
node->parent = nsparent; |
node->ns = curns; |
node->ns = curns; |
|
} else { |
|
node = xmlDocCopyNodeList(domintern->document->ptr, node); |
} |
} |
child = php_dom_create_object(node, &ret, NULL, child, domintern TSRMLS_CC); | |
| child = php_dom_create_object(node, &ret, child, domintern TSRMLS_CC); |
add_next_index_zval(args[i], child); |
add_next_index_zval(args[i], child); |
} |
} |
} |
} |
Line 293 static void xsl_ext_function_php(xmlXPathParserContext
|
Line 305 static void xsl_ext_function_php(xmlXPathParserContext
|
if (obj->stringval == NULL) { |
if (obj->stringval == NULL) { |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Handler name must be a string"); |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Handler name must be a string"); |
xmlXPathFreeObject(obj); |
xmlXPathFreeObject(obj); |
|
valuePush(ctxt, xmlXPathNewString("")); |
if (fci.param_count > 0) { |
if (fci.param_count > 0) { |
for (i = 0; i < nargs - 1; i++) { |
for (i = 0; i < nargs - 1; i++) { |
zval_ptr_dtor(&args[i]); |
zval_ptr_dtor(&args[i]); |
Line 314 static void xsl_ext_function_php(xmlXPathParserContext
|
Line 327 static void xsl_ext_function_php(xmlXPathParserContext
|
/*fci.function_handler_cache = &function_ptr;*/ |
/*fci.function_handler_cache = &function_ptr;*/ |
if (!zend_make_callable(&handler, &callable TSRMLS_CC)) { |
if (!zend_make_callable(&handler, &callable TSRMLS_CC)) { |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", callable); |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", callable); |
| valuePush(ctxt, xmlXPathNewString("")); |
} else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable, strlen(callable) + 1) == 0) { |
} else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable, strlen(callable) + 1) == 0) { |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not allowed to call handler '%s()'", callable); |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not allowed to call handler '%s()'", callable); |
/* Push an empty string, so that we at least have an xslt result... */ |
/* Push an empty string, so that we at least have an xslt result... */ |
Line 324 static void xsl_ext_function_php(xmlXPathParserContext
|
Line 337 static void xsl_ext_function_php(xmlXPathParserContext
|
if (result == FAILURE) { |
if (result == FAILURE) { |
if (Z_TYPE(handler) == IS_STRING) { |
if (Z_TYPE(handler) == IS_STRING) { |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(&handler)); |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(&handler)); |
|
valuePush(ctxt, xmlXPathNewString("")); |
} |
} |
/* retval is == NULL, when an exception occured, don't report anything, because PHP itself will handle that */ | /* retval is == NULL, when an exception occurred, don't report anything, because PHP itself will handle that */ |
} else if (retval == NULL) { |
} else if (retval == NULL) { |
} else { |
} else { |
if (retval->type == IS_OBJECT && instanceof_function( Z_OBJCE_P(retval), dom_node_class_entry TSRMLS_CC)) { |
if (retval->type == IS_OBJECT && instanceof_function( Z_OBJCE_P(retval), dom_node_class_entry TSRMLS_CC)) { |
Line 427 PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
|
Line 441 PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
|
std_hnd = zend_get_std_object_handlers(); |
std_hnd = zend_get_std_object_handlers(); |
MAKE_STD_ZVAL(member); |
MAKE_STD_ZVAL(member); |
ZVAL_STRING(member, "cloneDocument", 0); |
ZVAL_STRING(member, "cloneDocument", 0); |
cloneDocu = std_hnd->read_property(id, member, BP_VAR_IS TSRMLS_CC); | cloneDocu = std_hnd->read_property(id, member, BP_VAR_IS, NULL TSRMLS_CC); |
if (Z_TYPE_P(cloneDocu) != IS_NULL) { |
if (Z_TYPE_P(cloneDocu) != IS_NULL) { |
convert_to_long(cloneDocu); |
convert_to_long(cloneDocu); |
clone_docu = Z_LVAL_P(cloneDocu); |
clone_docu = Z_LVAL_P(cloneDocu); |
Line 465 PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
|
Line 479 PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
|
|
|
static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStylesheetPtr style, zval *docp TSRMLS_DC) /* {{{ */ |
static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStylesheetPtr style, zval *docp TSRMLS_DC) /* {{{ */ |
{ |
{ |
xmlDocPtr newdocp; | xmlDocPtr newdocp = NULL; |
xmlDocPtr doc = NULL; |
xmlDocPtr doc = NULL; |
xmlNodePtr node = NULL; |
xmlNodePtr node = NULL; |
xsltTransformContextPtr ctxt; |
xsltTransformContextPtr ctxt; |
Line 476 static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xs
|
Line 490 static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xs
|
zend_object_handlers *std_hnd; |
zend_object_handlers *std_hnd; |
FILE *f; |
FILE *f; |
int secPrefsError = 0; |
int secPrefsError = 0; |
int secPrefsValue; | int secPrefsValue, secPrefsIni; |
xsltSecurityPrefsPtr secPrefs = NULL; |
xsltSecurityPrefsPtr secPrefs = NULL; |
|
|
node = php_libxml_import_node(docp TSRMLS_CC); |
node = php_libxml_import_node(docp TSRMLS_CC); |
Line 527 static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xs
|
Line 541 static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xs
|
|
|
MAKE_STD_ZVAL(member); |
MAKE_STD_ZVAL(member); |
ZVAL_STRING(member, "doXInclude", 0); |
ZVAL_STRING(member, "doXInclude", 0); |
doXInclude = std_hnd->read_property(id, member, BP_VAR_IS TSRMLS_CC); | doXInclude = std_hnd->read_property(id, member, BP_VAR_IS, NULL TSRMLS_CC); |
if (Z_TYPE_P(doXInclude) != IS_NULL) { |
if (Z_TYPE_P(doXInclude) != IS_NULL) { |
convert_to_long(doXInclude); |
convert_to_long(doXInclude); |
ctxt->xinclude = Z_LVAL_P(doXInclude); |
ctxt->xinclude = Z_LVAL_P(doXInclude); |
} |
} |
efree(member); |
efree(member); |
|
|
|
secPrefsValue = intern->securityPrefs; |
|
|
secPrefsValue = INI_INT("xsl.security_prefs"); | /* This whole if block can be removed, when we remove the xsl.security_prefs php.ini option in PHP 6+ */ |
| secPrefsIni= INI_INT("xsl.security_prefs"); |
| /* if secPrefsIni has the same value as secPrefsValue, all is fine */ |
| if (secPrefsIni != secPrefsValue) { |
| if (secPrefsIni != XSL_SECPREF_DEFAULT) { |
| /* if the ini value is not set to the default, throw an E_DEPRECATED warning */ |
| php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "The xsl.security_prefs php.ini option is deprecated; use XsltProcessor->setSecurityPrefs() instead"); |
| if (intern->securityPrefsSet == 0) { |
| /* if securityPrefs were not set through the setSecurityPrefs method, take the ini setting */ |
| secPrefsValue = secPrefsIni; |
| } else { |
| /* else throw a notice, that the ini setting was not used */ |
| php_error_docref(NULL TSRMLS_CC, E_NOTICE, "The xsl.security_prefs php.ini was not used, since the XsltProcessor->setSecurityPrefs() method was used"); |
| } |
| } |
| } |
| |
/* if securityPrefs is set to NONE, we don't have to do any checks, but otherwise... */ |
/* if securityPrefs is set to NONE, we don't have to do any checks, but otherwise... */ |
if (secPrefsValue != XSL_SECPREF_NONE) { |
if (secPrefsValue != XSL_SECPREF_NONE) { |
secPrefs = xsltNewSecurityPrefs(); |
secPrefs = xsltNewSecurityPrefs(); |
Line 614 Since:
|
Line 644 Since:
|
*/ |
*/ |
PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc) |
PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc) |
{ |
{ |
zval *id, *rv = NULL, *docp = NULL; | zval *id, *docp = NULL; |
xmlDoc *newdocp; |
xmlDoc *newdocp; |
xsltStylesheetPtr sheetp; |
xsltStylesheetPtr sheetp; |
int ret, ret_class_len=0; |
int ret, ret_class_len=0; |
Line 658 PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc)
|
Line 688 PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc)
|
php_libxml_increment_doc_ref(interndoc, newdocp TSRMLS_CC); |
php_libxml_increment_doc_ref(interndoc, newdocp TSRMLS_CC); |
php_libxml_increment_node_ptr(interndoc, (xmlNodePtr)newdocp, (void *)interndoc TSRMLS_CC); |
php_libxml_increment_node_ptr(interndoc, (xmlNodePtr)newdocp, (void *)interndoc TSRMLS_CC); |
} else { |
} else { |
DOM_RET_OBJ(rv, (xmlNodePtr) newdocp, &ret, NULL); | DOM_RET_OBJ((xmlNodePtr) newdocp, &ret, NULL); |
} |
} |
} else { |
} else { |
RETURN_FALSE; |
RETURN_FALSE; |
Line 682 PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
|
Line 712 PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
|
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); |
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); |
sheetp = (xsltStylesheetPtr) intern->ptr; |
sheetp = (xsltStylesheetPtr) intern->ptr; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os", &docp, &uri, &uri_len) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "op", &docp, &uri, &uri_len) == FAILURE) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
Line 690 PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
|
Line 720 PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
|
|
|
ret = -1; |
ret = -1; |
if (newdocp) { |
if (newdocp) { |
if (strlen(uri) != uri_len) { |
|
xmlFreeDoc(newdocp); |
|
RETURN_FALSE; |
|
} |
|
ret = xsltSaveResultToFilename(uri, newdocp, sheetp, 0); |
ret = xsltSaveResultToFilename(uri, newdocp, sheetp, 0); |
xmlFreeDoc(newdocp); |
xmlFreeDoc(newdocp); |
} |
} |
Line 892 PHP_FUNCTION(xsl_xsltprocessor_set_profiling)
|
Line 918 PHP_FUNCTION(xsl_xsltprocessor_set_profiling)
|
int filename_len; |
int filename_len; |
DOM_GET_THIS(id); |
DOM_GET_THIS(id); |
|
|
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s!", &filename, &filename_len) == SUCCESS) { | if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p!", &filename, &filename_len) == SUCCESS) { |
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); |
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); |
if (intern->profiling) { |
if (intern->profiling) { |
efree(intern->profiling); |
efree(intern->profiling); |
} |
} |
if (filename != NULL && strlen(filename) == filename_len) { | if (filename != NULL) { |
intern->profiling = estrndup(filename,filename_len); |
intern->profiling = estrndup(filename,filename_len); |
} else { |
} else { |
intern->profiling = NULL; |
intern->profiling = NULL; |
Line 908 PHP_FUNCTION(xsl_xsltprocessor_set_profiling)
|
Line 934 PHP_FUNCTION(xsl_xsltprocessor_set_profiling)
|
} |
} |
} |
} |
/* }}} end xsl_xsltprocessor_set_profiling */ |
/* }}} end xsl_xsltprocessor_set_profiling */ |
|
|
|
/* {{{ proto long xsl_xsltprocessor_set_security_prefs(long securityPrefs) */ |
|
PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs) |
|
{ |
|
zval *id; |
|
xsl_object *intern; |
|
long securityPrefs, oldSecurityPrefs; |
|
|
|
DOM_GET_THIS(id); |
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &securityPrefs) == FAILURE) { |
|
return; |
|
} |
|
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); |
|
oldSecurityPrefs = intern->securityPrefs; |
|
intern->securityPrefs = securityPrefs; |
|
/* set this to 1 so that we know, it was set through this method. Can be removed, when we remove the ini setting */ |
|
intern->securityPrefsSet = 1; |
|
RETURN_LONG(oldSecurityPrefs); |
|
} |
|
/* }}} end xsl_xsltprocessor_set_security_prefs */ |
|
|
|
/* {{{ proto long xsl_xsltprocessor_get_security_prefs() */ |
|
PHP_FUNCTION(xsl_xsltprocessor_get_security_prefs) |
|
{ |
|
zval *id; |
|
xsl_object *intern; |
|
|
|
DOM_GET_THIS(id); |
|
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "") == SUCCESS) { |
|
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); |
|
RETURN_LONG(intern->securityPrefs); |
|
} else { |
|
WRONG_PARAM_COUNT; |
|
} |
|
} |
|
/* }}} end xsl_xsltprocessor_get_security_prefs */ |
|
|
|
|
|
|
/* {{{ proto bool xsl_xsltprocessor_has_exslt_support(); |
/* {{{ proto bool xsl_xsltprocessor_has_exslt_support(); |
*/ |
*/ |